<!DOCTYPE HTML>
<html manifest="news.manifest">
<head>
<meta charset="UTF-8">
<title>海豚阅读</title>
<meta name="format-detection" content="telephone=no"/>
<meta http-equiv="Cache-Control" content="no-transform"/> 
<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<link rel="apple-touch-icon" href="images/readerlogo.png"/>
<script>
	//优先进入应用模式
	if(window.dolphin && window.dolphin.launchWebAppMode){
		window.dolphin.launchWebAppMode();
	}else if(window.dolphinWebapp && window.dolphinWebapp.requestWebAppMode){
		window.dolphinWebapp.requestWebAppMode();
	}
</script>
<style>
/*为了适配IE10，加了transition和transform，但发现在一些android机器上会导致-webkit-transition失效，所以统一把transition写在-webkit-transition的前面*/
body{margin:0;padding:0;border:none;list-style:none;font-family:Arial;-webkit-text-size-adjust:none;-webkit-tap-highlight-color:rgba(0,0,0,0);background:#FFF;color:#000;font-size:16px;-ms-touch-action:none;-webkit-font-smoothing:antialiased;}
#wrapView{height:4000px;overflow:hidden;position:relative;}
#newslist{display:none;z-index:3;position:relative;background:#fff;}
#listHead{position:relative;height:40px;width:100%;overflow:hidden;font-weight:bold;color:#111;}
.blueline{height:18px;position:absolute;top:10px;width:100%;z-index:0;background:#2ca7ea;line-height:18px;}
#listHead .text{font-size:19px;line-height:21px;display:inline-block;background:#FFF;z-index:1;position:relative;margin:8px 0 0 4px;padding:0 5px;text-align:center;}
#backLBtn{position:absolute;left:0;top:1px;}
.refreshBtn{position:absolute;right:0;top:1px;height:40px;width:50px;background:url(images/bt.png) no-repeat -103px -726px;background-size:150px;display:inline-block;}
.refreshBtn:active{background-position:-103px -788px;}
#preSubBtn{position:absolute;right:0;top:1px;height:40px;width:50px;background:url(images/bt.png) no-repeat 6px -156px;background-size:150px;display:inline-block;}
#pageNum{line-height:45px;height:40px;display:inline-block;padding:0 10px;color:#999;font-size:15px;}
#pageNum.loading{background:url(images/loading.gif) no-repeat right 14px;background-size:15px;padding:0 30px 0 10px}
#listWrap, #detailWrap{overflow:hidden;position:relative;height:1000px;background:#FFF;}
.cardImg{margin:8px -8px -6px -8px;height:auto;min-height:220px;}
.rowContent .cardImg:last-child{margin-bottom:-14px;margin-top:0;}
.cardImg img{width:100%;}
#cards{display:none;z-index:3;position:relative;}
#cardsWrap{background-color:#e4e4e4;overflow:hidden;position:absolute;top:40px;left:0;}
#cardsHead{height:39px;width:100%;position:absolute;top:0;left:0;z-index:1;background-color:#1093d0;-moz-box-shadow:0px 1px 5px #666;-webkit-box-shadow: 0px 1px 5px #666;box-shadow:0px 1px 5px #666;border-bottom: 1px solid #0b6f9b;}
.cardsTitle{color:#fff;line-height:43px;margin-left:13px;}
.switch{float:right;font-size:12px;color:#f0f0f0;width:112px;height:40px;line-height:40px;background:url(images/bt.png) no-repeat -45px -849px;background-size:150px;display:inline-block;}
.switch.noPic{background:url(images/bt.png) no-repeat -45px -910px;background-size:150px;}
#listFooter{height:43px;text-align:center;position:relative;overflow:hidden;}
#cardsFooter{height:43px;width:100%;position:absolute;bottom:0;left:0;background-color:#fdfdfd;-moz-box-shadow:0px -1px 5px rgba(0,0,0,.3);-webkit-box-shadow: 0px -1px 5px rgba(0,0,0,.3);box-shadow:0px -1px 5px rgba(0,0,0,.3);border-top:1px solid #bbb;}
.cardsFooterWrap{width:100%;height:100%;position:relative;}
.cardsPageWrap{padding-bottom:12px;}
.authorName{font-size:14px;color:#4a4a4a;display:block;height:13px;padding-top:9px;}
.rowImgWrap{width:34px;height:34px;margin:8px;float:left;background:url(images/row_icon.png) no-repeat center center;background-size:34px;border-radius:2px;}
.rowHead{display:inline-block;width:100%;}
.rowTime{font-size:11px;color:#bfbfbf;}
.rowImg{width:34px;height:34px;display:block;border-radius:2px;}
.row{margin:8px 8px 10px 8px;border-radius:3px;background-color:#fdfdfd;-moz-box-shadow:0px 1px 3px #a2a2a2;-webkit-box-shadow:0px 1px 3px #a2a2a2;box-shadow:0px 1px 3px #a2a2a2;color:#111;line-height:23px;}
.rowContent{margin:8px;margin-top:4px;}
.rowFooter{height:40px;line-height:40px;background-color:#edf0f2;border-top:1px solid #e2e2e2;font-size:15px;color:#bfbfbf;border-bottom-left-radius:2px;border-bottom-right-radius:2px;}
.zan{float:left;}
.zanIcon{float:left;height:45px;width:31px;background:url(images/bt.png) no-repeat 2px -961px;background-size:150px;}
.zanIcon.active{background:url(images/bt.png) no-repeat 2px -1023px;background-size:150px;/*-webkit-transform-origin:bottom left;*/transition:transform 0.2s ease;-webkit-transition:-webkit-transform 0.2s ease;}
.zanText.active{color:#2d8de7;}
.rowShare{float:right;margin-right:8px;}
.rowShareIcon{float:left;height:45px;width:33px;background:url(images/bt.png) no-repeat -112px -958px;background-size:150px;}
.rowShareIcon.active{background:url(images/bt.png) no-repeat -112px -1020px;background-size:150px;transition:transform 0.4s ease;-webkit-transition:-webkit-transform 0.4s ease;}
.loadingMore{text-align:center;height:40px;line-height:40px;color:#5a5a5a;}
.loadingWrap{width:135px;height:40px;display:inline-block;}
.loadingIcon{float:left;width:30px;height:40px;background:url(images/loading1.gif) no-repeat center center;background-size:18px auto;}
.null{height:8px;}
.pageWrap, .artWrap, .pageAWrap, .artAWrap{position:absolute;top:0;left:0;height:100%;width:100%;transform:translate3d(0,0,0);-webkit-transform:translate3d(0,0,0);overflow:hidden;transition:transform 0.4s ease;-webkit-transition:-webkit-transform 0.4s ease;}
.pageWrap a, .pageAWrap a{text-decoration:none;-webkit-box-orient:vertical;display:-webkit-box;-webkit-box-pack:center;display:-ms-flexbox;-ms-flex-direction:column;-ms-flex-pack:center;}
@keyframes rightAni{0%{transform:translate3d(0,0,0);}50%{transform:translate3d(50px,0,0);}100%{transform:translate3d(0,0,0);}}
@keyframes leftAni{0%{transform:translate3d(0,0,0);}50%{transform:translate3d(-50px,0,0);}100%{transform:translate3d(0,0,0);}}
@-webkit-keyframes rightAni{0%{-webkit-transform:translate3d(0,0,0);}50%{-webkit-transform:translate3d(50px,0,0);}100%{-webkit-transform:translate3d(0,0,0);}}
@-webkit-keyframes leftAni{0%{-webkit-transform:translate3d(0,0,0);}50%{-webkit-transform:translate3d(-50px,0,0);}100%{-webkit-transform:translate3d(0,0,0);}}

.picDiv{position:relative;overflow:hidden;height:34%;background:#eee url(images/dolphin_w.png) no-repeat center center;background-size:25px;}
.picDiv .mask{width:100%;height:100%;position:absolute;bottom:0;background:-webkit-gradient(linear, 0 0, 0 bottom, from(rgba(0, 0, 0, 0)), to(rgba(0, 0, 0, 0.2)));}
.picDiv img{position:absolute;top:0;left:0;border:none;display:none;}
.picDiv .picTitle{font-size:18px;position:absolute;bottom:9px;text-shadow:1px 1px 1px #000;color:#FFF;max-height:40px;line-height:20px;overflow:hidden;font-weight:bold;padding:0 11px;}
.picDiv .picTitle.small{font-size:17px;}
.picTextWrap{overflow:hidden;border-bottom:1px solid #ccc;line-height:20px;height:24%;}
.picTextWrap .innerWrap:first-child .picText2{border-right:1px solid #ccc;}
.picText1{overflow:hidden;height:18%;border-bottom:1px solid #ccc;}
.pageWrap > div:last-child{border-bottom:none;}
.pageWrap > a:last-child{border-bottom:none;}
.innerWrap{overflow:hidden;float:left;width:50%;height:100%;font-size:16px;}
.picText2, .colorText2{height:100%;-webkit-box-orient:vertical;display:-webkit-box;-webkit-box-pack:center;display:-ms-flexbox;-ms-flex-direction:column;-ms-flex-pack:center;}
.text1Title{font-size:17px;color:#111;padding:0 9px;max-height:40px;overflow:hidden;line-height:20px;}
.text1Title.small{font-size:16px;}
.text1Title.large{font-size:18px;}
.text2Title{font-size:17px;color:#111;padding:0 9px;max-height:60px;overflow:hidden;line-height:20px;}
.text2Title.small{font-size:14px;}
.text2Title.large{font-size:18px;}
.text1Des, .text2Des{color:#999;font-size:10px;padding:0 9px;height:16px;line-height:20px;overflow:hidden;}
.pageWrap a:visited .text1Title, .pageWrap a.visited .text1Title,
.pageWrap a:visited .text2Title, .pageWrap a.visited .text2Title{color:#6D6D6D;}

.colorDiv{position:relative;overflow:hidden;height:25%;color:#FFF;}
.color0{background:#1193e9;}
.color1{background:#0b6ac4;}
.color2{background:#e6b900;}
.color3{background:#fa5000;}
.colorDiv .colorTitle{font-size:22px;font-weight:bold;line-height:24px;max-height:72px;overflow:hidden;padding:0 9px;}
.colorDes{font-size:10px;padding:0 11px;height:20px;line-height:20px;overflow:hidden;}
.colorTextWrap{overflow:hidden;border-bottom:1px solid #ccc;line-height:22px;height:27%;}
.colorTextWrap .innerWrap:first-child .colorText2{border-right:1px solid #ccc;}
.colorTitle.small{font-size:20px;}
.color1Title{font-size:17px;color:#000;padding:0 9px;max-height:40px;overflow:hidden;line-height:20px;}
.color1Title.small{font-size:16px;}
.color1Title.large{font-size:18px;}
.color2Title{font-size:17px;color:#000;padding:0 9px;max-height:60px;overflow:hidden;line-height:20px;}
.color2Title.small{font-size:14px;}
.color2Title.large{font-size:18px;}
.colorText1{overflow:hidden;height:21%;border-bottom:1px solid #ccc;}
.pageWrap a:visited .color1Title,.pageWrap a.visited .color1Title,
.pageWrap a:visited .color2Title,.pageWrap a.visited .color2Title{color:#6D6D6D;}

#loading{position:absolute;top:0;left:0;z-index:9;width:100px;height:40px;background:url(images/loading.gif) no-repeat 0 center;font-size:17px;line-height:42px;color:#ACACAC;padding-left:30px;background-size:20px;display:none;}
#loading.dark{background-image:url(images/loadingb.gif);color:#666;}
#tipBar{position:absolute;bottom:10px;height:25px;line-height:25px;width:55%;background:rgba(0,0,0,0.6);color:#fffcad;text-align:right;padding-right:10px;border-radius:0 5px 5px 0;display:none;z-index:3}

#detail{transform:translate3d(0,0,0);-webkit-transform:translate3d(0,0,0);position:absolute;top:0;left:0;z-index:4;display:none;width:100%;}
#detailFoot{height:42px;border-top:1px solid #ddd;background:#f5f5f5;position:relative;text-align:center;}
.backBtn{height:39px;width:50px;background:url(images/bt.png) no-repeat 6px -658px;background-size:150px;display:inline-block;position:absolute;left:0;top:0;}
#backABtn:active,.backBtn:active{background-position:6px -726px;}
#backABtn{background-position:6px -583px;background-size:150px;margin-top:-1px;}
.shareBtn{height:39px;width:50px;background:url(images/bt.png) no-repeat -103px -353px;background-size:150px;display:inline-block;margin:0 auto;}
#shareABtn:active,.shareBtn:active{background-position:-103px -407px;}
#shareABtn{background-position:-103px -277px;}
#homeABtn{background-position:6px -792px;}
#homeABtn:active{background-position:6px -910px;}
.settingBtn{height:39px;width:50px;background:url(images/bt.png) no-repeat -103px -527px;background-size:150px;display:inline-block;position:absolute;right:0;top:0;}
.settingBtn:active{background-position:-103px -581px;}
.homeBtn{height:39px;width:50px;background:url(images/bt.png) no-repeat 6px -850px;background-size:150px;display:inline-block;position:absolute;right:0;top:0;}
.homeBtn:active{background-position:6px -910px;}
#settingPanel{background:rgba(0,0,0,0.5);width:100%;heiht:100%;position:absolute;top:0;left:0;z-index:3;display:none;}
#bsetting{position:absolute;bottom:0;left:0;width:100%;background:#f5f5f5;}
#bsetting > div{height:54px;border-top:1px solid #ccc;line-height:55px;padding:0 15px;}
#sfont, #snight{float:right;font-size:15px;}
#sfont > span, #snight > span{display:inline-block;border:1px solid #ccc;padding:4px 20px;line-height:22px;height:22px;}
#sfont > span:first-child, #snight > span:first-child{border-right:none;}
#sfont > span.on, #snight > span.on{background:#aaa;color:#fff;}
.artDrag{transform:translate3d(0,0,0);-webkit-transform:translate3d(0,0,0);}
.artHead1{height:25px;overflow:hidden;}
.btop0{border-top:4px solid #1193e9;}
.btop1{border-top:4px solid #0b6ac4;}
.btop2{border-top:4px solid #e6b900;}
.btop3{border-top:4px solid #fa5000;}
.artSource1{font-size:12px;color:#FFF;float:left;height:25px;line-height:25px;padding:0 20px;margin-left:10px;}
.btop0 .artSource1{background:#1193e9;}
.btop1 .artSource1{background:#0b6ac4;}
.btop2 .artSource1{background:#e6b900;}
.btop3 .artSource1{background:#fa5000;}
.artHead1 span{float:right;display:inline-block;font-size:11px;color:#666;margin:6px 20px 0 0;}
.title1{font-size:21px;font-weight:bold;line-height:26px;margin:0 15px;padding:13px 0 10px;word-break:break-all;color:#111;}
.content{line-height:26px;padding:10px 0;margin:0 15px;border-top:1px solid #ccc;font-size:18px;}
.content br{display:block;height:5px;content:" ";} /*使用content控制br元素的高度*/
.contentImgWrap{overflow:hidden;margin:10px 0;text-align:center;background:#EEE url(images/dolphin_w.png) no-repeat center center;background-size:25px;height:173px;}
.row .contentImgWrap{margin:10px -8px;}
.contentImgWrap img{border:none;display:none;margin:0 auto;background:#eee; max-height: 750px;}
.artSource2{font-size:14px;float:left;height:25px;line-height:25px;padding:4px 20px 0;margin-left:10px;}
.artHead2{height:36px;overflow:hidden;color:#666;}
.artHead2 span{float:right;display:inline-block;font-size:13px;margin:8px 20px 0 0;}
.title2{font-size:21px;font-weight:bold;line-height:26px;margin-bottom:13px;color:#111;}
.title2Inner{background:#FFF;width:70%;margin-left:10px;padding:0 10px;word-break:break-all;}
.cLoading{position:absolute;width:100px;height:40px;margin-left:-50px;margin-top:-20px;background:url(images/loading.gif) no-repeat 0 center;background-size:20px;line-height:42px; padding-left:30px;font-size:17px;color:#ACACAC;}

#cList{display:none;transform:translate3d(0,0,0);-webkit-transform:translate3d(0,0,0);position:absolute;top:0;left:0;z-index:2;background:#e5f0f5 no-repeat center 65%;transition:transform 0.5s ease;-webkit-transition:-webkit-transform 0.5s ease;-webkit-user-select:none;-webkit-touch-callout:none;-ms-user-select:none;width:100%;background-size:100% auto;}
#welPanel{display:none;position:absolute;top:0;left:0;z-index:7;width:100%;height:100%;overflow:hidden;transform:translate3d(0,0,0);-webkit-transform:translate3d(0,0,0);transition:transform 0.3s ease;-webkit-transition:-webkit-transform 0.3s ease;color:#fff;}
.logoReader{font-size:27px;margin:20px 0 0 20px;padding-left:55px;background:url(images/btn.png) no-repeat -104px 0;background-size:150px;height:48px;line-height:46px;text-shadow:rgba(0,0,0,0.3) 1px 1px 1px;}
.welText{position:absolute;bottom:25px;right:0;text-align:right;padding:12px;text-shadow:rgba(0,0,0,0.3) 0 0 1px;width:100%;line-height:25px;}
.cListBtns{width:30px;height:180px;position:absolute;z-index:6;bottom:0;right:20px;}
.cListBtns > span, .cListBtns > a{position:absolute;background:url(images/btn.png) no-repeat;background-size:150px;display:inline-block;}
.popup{width:140px;position:absolute;bottom:45px;font-size:18px;color:#f9f9f9;right:2px;background-color:rgba(21,21,21,0.9);border-radius:5px;border:2px solid #303030;-webkit-box-shadow:1px 1px 5px #000;}
.subicon{background:url(images/cfpic.png) no-repeat center top;display:block;height:9px;background-size:15px 9px;width:16px;position:absolute;top:-2px;left:50%;margin-left:-8px;}
#clearBtn, #sendToDBtn{height:50px;display:block;line-height:50px;}
#sendToDBtn{border-bottom: 1px solid #4e4e4e;}
#clearBtn span:first-child, #sendToDBtn span:first-child{display:inline-block;float:left;width:40px;height:50px;background-image:url(images/bt.png);background-size:150px;}
#setBtn{background-position:3px -150px;}
#addSmall{background-position:3px -75px;}
#channelWrap{position:relative;overflow:hidden;}
#clistHead{height:80px;position:absolute;width:100%;}
#clistHead span{display:inline-block;}
#headCol{width:7px;height:37px;background-color:#5da530; margin-top:25px;}
#headTitle{margin-left:23px;font-size:40px;color:#464646;top:21px;position:absolute;}
#headPage{float:right;margin-right:21px;margin-top:25px;display:block;height:40px;line-height:40px;}
#clistFooter{height:45px;background-color:rgba(0,0,0,0.5);}
#clistWrap{overflow:hidden;height: 3000px;}
#clistFooter .footerBtn{display:inline-block;width:33.3%;height:45px;text-align:center;position:relative;}
.footerBtn span{background-image:url(images/bt.png);background-size:150px;display:inline-block;height:45px;width:40px;}
#exitBtn span {background-position:left 1px;}
#exitBtn:active span{background-position:left -46px;}
#addSmall span {background-position:left -99px;}
#addSmall:active span{background-position:left -156px;}
#setBtn > span {background-position:3px -216px;}
#setBtn > span:active{background-position:3px -277px;}
#clearBtn span{background-position:43px -107px;}
#clearBtn:active span{background-position:43px -160px;color:#36a02e;}
#sendToDBtn span{background-position:42px 5px;}
#sendToDBtn:active span{background-position:42px -44px;color:#36a02e;}
.popup span.btnText{background:none;width:auto;display:inline-block;text-align:center;}
.recommend{background:url(images/recommend.png) no-repeat center top;background-size:20px;display:inline-block;width:20px;height:20px;position:absolute;left:0px;top:0px;}
.updates{display:inline-block;height:0;position:absolute;right:6px;bottom:4px;font-size:15px;font-family:"roboto light";transition:height 0.2s ease;-webkit-transition:height 0.2s ease;overflow:hidden;}

#cPage{font-size:24px;color:#464646;width:29px;}
#cPageTotal{font-size:15px;color:#666;}
.iconTitle{display:inline-block;position:absolute;left:6px;bottom:5px;font-size:15px;line-height:20px;}
.iconPage{position:absolute;top:0;left:0;height:100%;width:100%;transform:translate3d(0,0,0);-webkit-transform:translate3d(0,0,0);opacity:1;margin-top:80px;/*transition:opacity 0.25s ease;-webkit-transition:opacity 0.25s ease;*/}
.iconPage > div{display:inline-block;width:100px;height:100px;color:#FFF;text-align:center;overflow:hidden;position:absolute;transform:translate3d(0,0,0);-webkit-transform:translate3d(0,0,0);transition-duration:0.4s;-webkit-transition-duration:0.4s;transition-property:transform,opacity;-webkit-transition-property:-webkit-transform,opacity;transition-timing-function:ease;-webkit-transition-timing-function:ease;font-size:15px;}
.iconPage .iconImg{width:50%;margin-top:23px;}
.iconPage > div.normal{background-color:rgba(93,165,48,0.8);}
.iconPage > div.special{background-color:rgba(93,165,48,0.8);}
.iconPage > div.addBtn{background:rgba(93,165,48,0.9) url(images/add.png) no-repeat center;background-size:28px;}
.iconPage > div span.delbtn{background:url(images/bt.png) no-repeat -7px -475px;background-size:150px;position:absolute;top:5px;left:5px;display:inline-block;width:30px;height:30px;}
.iconPage > div.iconActive{background-color:rgba(93,165,48,0.95);}

.pageAWrap{-webkit-box-sizing:border-box;box-sizing:border-box;padding:8px 8px 0;}
.picWInner{overflow:hidden;}
.picWInner{width:100%;height:100%;background:#eee url(images/dolphin_w.png) no-repeat center center;background-size:25px;}
.picWInner img{border:none;display:none;margin:0 auto;}
.album5R1{height:40%;padding-bottom:3px;-webkit-box-sizing:border-box;box-sizing:border-box;}
.album5R2{height:20%;padding:3px 0;-webkit-box-sizing:border-box;box-sizing:border-box;}
.album5R3{height:40%;padding-top:3px;-webkit-box-sizing:border-box;box-sizing:border-box;}
.album5Wrap2L{float:left;width:34%;height:100%;-webkit-box-sizing:border-box;box-sizing:border-box;padding-right:6px;}
.albumWrap2Up{height:50%;padding-bottom:3px;-webkit-box-sizing:border-box;box-sizing:border-box;}
.albumWrap2Down{height:50%;padding-top:3px;-webkit-box-sizing:border-box;box-sizing:border-box;}
.albumWrapBigR{width:66%;height:100%;float:left;-webkit-box-sizing:border-box;box-sizing:border-box;}
.albumWrap1Left{float:left;width:34%;height:100%;-webkit-box-sizing:border-box;box-sizing:border-box;padding-right:6px;}
.albumTitle{float:left;width:66%;height:100%;-webkit-box-sizing:border-box;box-sizing:border-box;text-align:center;color:#fff;font-size:17px; -webkit-box-orient:vertical;display:-webkit-box;-webkit-box-pack:center;display:-ms-flexbox;-ms-flex-direction:column;-ms-flex-pack:center;}
.albumWrapBigL{width:66%;height:100%;float:left;-webkit-box-sizing:border-box;box-sizing:border-box;}
.album5Wrap2R{float:left;width:34%;height:100%;-webkit-box-sizing:border-box;box-sizing:border-box;padding-left:6px;}
.album4R1{height:25%;padding-bottom:2px;-webkit-box-sizing:border-box;box-sizing:border-box;}
.album4R2{height:25%;padding:2px 0;-webkit-box-sizing:border-box;box-sizing:border-box;}
.album4R3{height:50%;padding-top:2px;-webkit-box-sizing:border-box;box-sizing:border-box;}
.album4R1 .albumWrap1Left, .album4R2 .albumWrap1Left, .album4R3 .album5Wrap2L{padding-right:4px;}
.album4R3 .albumWrap2Up{padding-bottom:2px;}
.album4R3 .albumWrap2Down{padding-top:2px;}
.album4Wrap2R{float:left;-webkit-box-sizing:border-box;box-sizing:border-box;width:66%;height:100%;}
.album4Wrap2RL{float:left;-webkit-box-sizing:border-box;box-sizing:border-box;width:50%;height:100%;padding-right:2px;}
.album4Wrap2RR{float:left;-webkit-box-sizing:border-box;box-sizing:border-box;width:50%;height:100%;padding-left:2px;}
.imgSpan{display:block;height:100%;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;background:#eee;}

#albumDetail{transform:translate3d(0,0,0);-webkit-transform:translate3d(0,0,0);position:absolute;top:0;left:0;z-index:4;background:#000;display:none;}
#albumWrap{overflow:hidden;position:relative;height:1000px;background:#000;}
.artAWrap{-webkit-box-orient:vertical;display:-webkit-box;-webkit-box-pack:center;background:#000 url(images/dolphin_w.png) no-repeat center center;background-size:25px;text-align:center;display:-ms-flexbox;-ms-flex-direction:column;-ms-flex-pack:center;}
.artAWrap img{border:none;display:none;margin:0 auto;height:100%;width:100%;}
#detailAHead{position:absolute;top:0;left:0;right:0;height:85px;overflow:hidden;color:#FFF;font-size:20px;padding:15px 10px 0 10px;line-height:23px;-webkit-transition: opacity .5s ease;transition: background-color .5s ease-out;z-index:1;background:-webkit-gradient(linear,left top, left bottom,from(rgba(0,0,0,.5)),to(rgba(0,0,0,0)));}
#detailAFoot{position:absolute;bottom:0;width:100%;height:39px;overflow:hidden;background:rgba(0,0,0,0.8);text-align:center;-webkit-transition: opacity .5s ease;transition: background-color .5s ease-out;border-top:1px solid #181818;}
.picbarWrap{position:absolute;bottom:0;width:100%;height:2px;background:#121212;overflow:hidden;}
#picBar{background:#2691cc;height:2px;}

#subSection{display:none;transform:translate3d(0,0,0);-webkit-transform:translate3d(0,0,0);position:absolute;top:0;left:0;z-index:7;background:#fff;-webkit-user-select:none;-webkit-touch-callout:none;-ms-user-select:none;width:100%;}
#subHead{line-height:43px;background:#2ca7ea;color:#FFF;position:relative;text-align:center;}
#subTitle{margin:0 auto;font-size:20px;}
#subBack{display:none;position:absolute;height:43px;width:50px;left:0;top:0;background:url(images/btn.png) no-repeat 8px -1007px;background-size:170px;}
#subOK{display:block;position:absolute;height:43px;width:50px;right:0;top:0;background:url(images/btn.png) no-repeat 12px -967px;background-size:150px;}
#subList, #subDList{overflow:hidden;position:absolute;top:43px;left:0;transform:translate3d(0,0,0);-webkit-transform:translate3d(0,0,0);background:#fff;width:100%;}
#subListDrag > a{display:block;height:65px;border-bottom:1px solid #ccc;line-height:65px;overflow:hidden;background:url(images/btn.png) no-repeat right -426px;background-size:150px;text-decoration:none;color:#000;font-size:20px;}
#subListDrag > a:active{background-color:#F4F4F4}
#subListDrag > a span{display:inline-block;height:65px;width:48px;float:left;background-position:center center;background-repeat:no-repeat;background-size:28px;}
#subDListDrag > div{height:65px;border-bottom:1px solid #ccc;line-height:65px;overflow:hidden;font-size:20px;}
#subDListDrag > div span{display:inline-block;height:65px;}
#subDListDrag > div span.logo{width:48px;float:left;background-position:center center;background-repeat:no-repeat;background-size:28px;}
#subDListDrag > div span.ordered{width:60px;float:right;background:url(images/btn.png) no-repeat right -816px;background-size:150px;}
#subDListDrag > div span.ordering{width:60px;float:right;background:url(images/btn.png) no-repeat right -741px;background-size:150px;}
.toOriginal {display:block;text-decoration:none;height:36px;background-color:#f2f2f2;border:1px solid #cecece;border-radius:4px;font-size:16px;color:#828282;text-align:center;margin-top:20px;line-height: 36px;}
#confirmWrap{height:100%;width:100%;z-index:9;position:absolute;left:0;top:0;display:none;}
#confirmView{width:284px;background-color:rgba(0,0,0,0.9);position:absolute;left:0;top:0;border-radius:5px;-webkit-box-shadow:0px 5px 15px rgba(0, 0, 0, 0.5);z-index:9;text-align:center;}
#confirmContent{font-size:20px;color:#EEE;margin-top:40px;margin-bottom:20px;}
#confirmButton button{margin-bottom:20px;font-size:14px;color:#F2F2F2;height:40px;width:100px;background:-webkit-linear-gradient(top, #474747, #2C2C2C);border-radius:3px;border-color:transparent;border:1px solid #1e1e1e;-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.4),0 1px 1px -1px #FFF inset;}
#confirmButton button:active{background:-webkit-linear-gradient(top, #3A3A3A, #474747);}
#confirmButton button#cancelBtn{margin-right:18px;}
#toast{padding: 11px 25px;background-color: rgba(0,0,0,0.85);z-index: 9;position: absolute;top: 0px;left: 0px;font-size: 12px;color: #EEE;border-radius: 2px;text-align: center;-webkit-transition: opacity 1s ease;transition: background-color 1s ease-out;opacity:0;}

@media (max-height:350px) {
	/*减小header的大小以满足横屏高度较小的问题*/
	#headCol, #headPage{margin-top:15px;height:27px;}
	#headTitle{top:11px;font-size:30px;}
}

@media screen and (orientation:landscape){
	.picTextWrap,.colorTextWrap{display:inline-block;height:100%;width:33.3%;position:absolute;left:66.6%;top:0;}
	.picTextWrap:first-child,.picTextWrap:nth-child(2),
	.colorTextWrap:first-child,.colorTextWrap:nth-child(2){left:0;}
	.picTextWrap .innerWrap,
	.colorTextWrap .innerWrap{height:50%;width:100%;}
	.picTextWrap:nth-child(3) .innerWrap:first-child .picText2,
	.picTextWrap:nth-child(4) .innerWrap:first-child .picText2,
	.colorTextWrap:nth-child(3) .innerWrap:first-child .colorText2,
	.colorTextWrap:nth-child(4) .innerWrap:first-child .colorText2{border-left:1px solid #ccc;;border-right:none;}
	.picTextWrap .innerWrap:nth-child(2) .picText2,
	.colorTextWrap .innerWrap:nth-child(2) .colorText2{border-left:1px solid #ccc;border-top:1px solid #ccc;}
	.picTextWrap:first-child .innerWrap:nth-child(2) .picText2,
	.picTextWrap:nth-child(2) .innerWrap:nth-child(2) .picText2,
	.colorTextWrap:first-child .innerWrap:nth-child(2) .colorText2,
	.colorTextWrap:nth-child(2) .innerWrap:nth-child(2) .colorText2{border-left:none;border-right:1px solid #ccc;}
	.picDiv,.colorDiv{position:absolute;height:50%;width:33.3%;left:33.3%;top:0;}
	.picText1,.colorText1{position:absolute;height:50%;width:33.3%;left:33.3%;top:50%;border-top:1px solid #ccc;}
}

</style>
</head>
<body>
<div id="wrapView">
	<section id="newslist">
		<header id="listHead"></header>
		<div id="listWrap"></div>
		<footer id="listFooter"><span id="backLBtn" class="backBtn"></span><span id="pageNum"></span><span id="refreshBtn" class="refreshBtn"></span><span id="preSubBtn" style="display:none;"></span></span></footer>
	</section>
	<section id="cards">
		<header id="cardsHead"><span id="cardsTitle" class="cardsTitle"></span><span id="switchBtn" class="switch">显示图片</span></header>
		<div id="cardsWrap">
			<div id="picWrap" class="cardsPageWrap">
				<div id="picRows"></div>
				<div id="picLoading" class="loadingMore" style="visibility:hidden;">
					<div class="loadingWrap"><span class='loadingIcon'></span><span class="loadingText">努力加载中...</span></div>
				</div>
			</div>
			<div id="noPicWrap" class="cardsPageWrap">
				<div id="textRows"></div>
				<div id="textLoading" class="loadingMore" style="visibility:hidden;">
					<div class="loadingWrap"><span class='loadingIcon'></span><span class="loadingText">努力加载中...</span></div>
				</div>
			</div>
		</div>
		<footer id="cardsFooter"><div class="cardsFooterWrap"><span id="backCBtn" class="backBtn"></span><span id="refreshCBtn" class="refreshBtn"></span></div></footer>
	</section>
	<section id="detail">
		<div id="detailWrap"></div>
		<footer id="detailFoot"><span id="backBtn" class="backBtn"></span><span id="shareBtn" class="shareBtn"></span><span id="settingBtn" class="settingBtn" style="display:none"></span><span id="homeBtn" class="homeBtn"></span></footer>
		<div id="settingPanel">
			<div id="bsetting">
				<div><div id="sfont"><span id="fontBig">大</span><span id="fontSmall" class="on">小</span></div>字体大小</div>
				<div><div id="snight"><span id="nightOn">开</span><span id="nightOff" class="on">关</span></div>夜间模式</div>
			</div>
		</div>
	</section>
	<section id="albumDetail">
		<header id="detailAHead"></header>
		<div id="albumWrap"></div>
		<footer id="detailAFoot">
			<span id="backABtn" class="backBtn"></span><span id="shareABtn" class="shareBtn"></span><span id="homeABtn" class="homeBtn"></span>
			<div class="picbarWrap"><div id="picBar"></div></div>
		</footer>
	</section>
	<section id="cList">
		<header id="clistHead"><span id="headCol"></span><span id="headTitle">海豚阅读</span><span id="headPage"><span id="cPage"></span><span id="cPageTotal"></span></span></header>
		<div id="clistWrap">
			<!--<div class="cListBtns"><span id="sendToDBtn"></span><span id="clearBtn"></span><span id="setBtn"></span><a id="addSmall" href="#subscribe"></a></div>-->
			<div id="welPanel"><div class="logoReader">海豚阅读</div><div class="welText">选择最有价值、最适合自己所需要的读物<br/>-- 别林斯基</div></div>
			<div id="channelWrap" onselectstart="return false;" onselect="return false;"></div>
		</div>
		<footer id="clistFooter">
			<span id="exitBtn" class="footerBtn"><span></span></span><a id="addSmall" class="footerBtn" href="#subscribe"><span></span></a><span id="setBtn" class="footerBtn"><span></span>
				<div id="clistSetPanel" style="display:none;">
					<div class="popup">
						<div id="sendToDBtn"><span></span><span class="btnText">发送到桌面</span></div>
						<div id="clearBtn"><span></span><span class="btnText">清除缓存</span></div>
					</div>
					<div class="subicon"></div>
				</div>
			</span>
		</footer>
	</section>
	<section id="subSection">
		<header id="subHead"><span id="subBack"></span><span id="subTitle">订阅频道</span><span id="subOK"></span></header>
		<div id="subList"><div id="subListDrag"></div></div>
		<div id="subDList"><div id="subDListDrag"></div></div>
	</section>
	<div id="loading">努力加载中...</div>
	<div id="confirmWrap" onselectstart="return false;" onselect="return false;">
		<div id="confirmView"><div id="confirmContent"></div><div id="confirmButton"><button id="cancelBtn">取消</button><button id="okBtn">确定</button></div></div>
	</div>
	<div id="toast"></div>
</div>
<div id="tipBar">hi</div>
</body>
</html>
<script src="baina.js"></script>
<script>
var Reader = function(obj){
	this.init(obj);
};
Reader.prototype = {
	Categories : [],//订阅的频道列表
	displayCat : {},//当前频道相关
	newsNum : 6,//每页显示新闻的条数
	picNum : 7,//每页显示图片的条数
	cardsNum : 10,//每次请求10条数据
	isCardsRequest : {
		text: false,
		pic: false
	},
	pages : 5,//每次请求的页数（因此每次的篇数就是newsNum或者picNum乘以pages
	maxPages : 60,//list最多多少页
	vH : 480,//默认高度
	vW : 320,//默认宽度
	dataPosition : "new",//数据分new、left、right三种。new是全新的，left为左侧刷新，相当于请求最新的数据。right为请求之后的数据，即右侧刷新
	requestLeft : false,
	requestRight : false,
	listOK : false,//list是否已经渲染过了
	curPage : 0,//目前list所在的页面，从0计数
	totalPage : 0,//list的总页数
	wrapView : null,//最外层的包裹
	newslist : null,//新闻list
	listHead : null,//新闻list的head部分
	listFooter : null,//新闻list的footer部分
	backLBtn : null,//新闻list部分的返回按钮
	backCBtn : null,//卡片list的返回按钮
	refreshBtn : null,//新闻list的刷新按钮
	refreshCBtn : null, //卡片模板List的刷新按钮
	preSubBtn : null,//订阅预览新闻list的订阅按钮
	pageNum : null,//页脚的页码
	listWrap : null,//每一页的新闻list的包裹
	curDiv : null,//list当前的div
	nextDiv : null,//list下一页的div
	prevDiv : null,//list上一页的div
	detail : null,//整个detail模块
	detailNewsMode : false,//是否处于显示新闻detail的状态
	detailWrap : null,//各个detail的包裹
	detailFoot : null,//detail的底部条
	settingPanel : null,//设置整个面板
	sfont : null,//切换大小字体的按钮
	fontBig : null,//大字体
	fontSmall : null,//小字体
	snight : null,//切换夜间模式的按钮
	nightOn : null,//夜间模式开启
	nightOff : null,//夜间模式关闭
	bsetting : null,//设置部分有文字的地方
	settingBtn : null,//设置按钮
	homeBtn : null,//detail页面回到首页按钮
	homeABtn : null,//图集detail页面回到首页按钮
	backBtn : null,//返回按钮
	curArtDiv : null,//当前文章的div
	nextArtDiv : null,//下一篇文章的div
	prevArtDiv : null,//上一篇文章的div
	curNewsId : 0,//当前新闻的id
	curIndex : -1,//当前的新闻、图集处于列表list中的位置
	dNoList : false,//是否直接进入的detail
	listLen : 0,//list新闻的条数
	cList : null,//频道订阅的section
	clistWrap : null,//频道订阅的包裹（去掉head和footer）
	iPages : [],//icon的页面集合
	iPageLen : 0,//icon一共有多少页
	icons : [],//icons图标的集合，二维数组。每一项为一页的icon
	addPage : {},//大加号位于第几页的第几个{pNum:0,count:0}
	cPage : null,//icon页面的页码
	cPageTotal : null,//iconPage的总页数
	sendToDBtn : null,//海豚特有的发送到桌面
	clearBtn : null,//清空缓存的按钮
	setBtn :null,//设置按钮
	clistSetPanel : null, //CList页面设置按钮的弹出框
	exitBtn : null, //退出当前webapp页面
	addSmall : null,//添加频道（小）
	channelWrap : null,//订阅频道的列表包裹
	iconCurPage : 0,//目前icons的列表位于第几页
	hNum : 1,//水平方向最多可以放几个icon
	vNum : 1,//竖直方向最多可以放几个icon
	hMargin : 15,//iconPage竖直方向顶部的margin
	eachPageNum : 1,//每页最多可以放几个
	iconPadding : 0,//icon需要填充的空白区域
	iconWidth : 115,//icon的占位宽度，含margin
	lMargin : 28,//iconPage左边的margin
	welPanel : null,//欢迎的页面
	albumDetail : null,//图集的detail页面的包裹
	albumWrap : null,//各个图片的包裹
	detailAFoot : null,//图集显示时候，底部bar
	backABtn : null,//图集的返回按钮
	shareABtn : null,//图集的分享按钮
	curPicDiv : null,//当前图片的div
	prevPicDiv : null,//上一幅图片的div
	nextPicDiv : null,//下一幅图片的div
	curAlbumId : 0,//当前图集的id
	curPicIndex : 0,//当前图片位于图集中的位置
	picBar : null,//图集底部的进度条，标明处于第几幅图
	subSection : null,//订阅模块
	subListOK : false,//订阅的列表是否加载了
	subHead : null,//订阅的头部
	subList : null,//订阅分类的列表
	subListDrag : null,//订阅分类滑动拖拽的部分
	subDList : null,//订阅频道的列表（每个分类都有一些频道）
	subDListDrag : null,//订阅频道的列表滑动拖拽的部分
	DListDrag : null,//控制的句柄，主要用来重置cy，具体可以参照baina.js中关于touchset的说明
	picDrag : null, //有图模式的滑动模块
	noPicDrag : null, //无图模式的滑动模块
	subBack : null,//订阅返回按钮，在subDList返回subList的时候使用
	subOK : null,//订阅完成按钮
	subTitle : null,//订阅类别的名称
	loading : null,//loading的块
	picCardLoading : null,//卡片模板的有图loading
	textCardLoading : null,//卡片模板的无图loading
	tipBar : null,//提示信息
	hArray : [],//记录用户访问的历史 historyArray
	sValues : {bigFont:false,nightMode:false},//用户的设置信息
	hasWelPanel : false,
	isAlbumHeadShow : true,
	picOff : false,//判断是无图还是有图模式
	isUpdateChannel : false,//判断是否更新过channel缓存了，默认是否
	isGetUpdates : false,//判断是否请求频道的更新数目
	delChannels : [],//维护一个用户取消订阅频道的列表，用于更新用户的channel缓存数据
	init : function(obj){
		var tempThis = this;
		this.launchTiming = new Date();
		this.wrapView = baina.$(obj.wrapView);
		this.newslist = baina.$(obj.newslist);
		this.listHead = baina.$(obj.listHead);
		this.listFooter = baina.$(obj.listFooter);
		this.backLBtn = baina.$(obj.backLBtn);
		this.backCBtn = baina.$(obj.backCBtn);
		this.pageNum = baina.$(obj.pageNum);
		this.listWrap = baina.$(obj.listWrap);
		this.cards = baina.$(obj.cards);
		this.cardsHead = baina.$(obj.cardsHead);
		this.cardsWrap = baina.$(obj.cardsWrap);
		this.picWrap = baina.$(obj.picWrap);
		this.noPicWrap = baina.$(obj.noPicWrap);
		this.textRows = baina.$(obj.textRows);
		this.picRows = baina.$(obj.picRows);
		this.cardsFooter = baina.$(obj.cardsFooter);
		this.cardsTitle = baina.$(obj.cardsTitle);
		this.switchBtn = baina.$(obj.switchBtn);
		this.picLoading = baina.$(obj.picLoading);
		this.textLoading = baina.$(obj.textLoading)
		this.detail = baina.$(obj.detail);
		this.detailWrap = baina.$(obj.detailWrap);
		this.detailFoot = baina.$(obj.detailFoot);
		this.settingPanel = baina.$(obj.settingPanel);
		this.bsetting = baina.$(obj.bsetting);
		this.settingBtn = baina.$(obj.settingBtn);
		this.homeBtn = baina.$(obj.homeBtn);
		this.homeABtn = baina.$(obj.homeABtn);
		this.sfont = baina.$(obj.sfont);
		this.fontBig = baina.$(obj.fontBig);
		this.fontSmall = baina.$(obj.fontSmall);
		this.snight = baina.$(obj.snight);
		this.nightOn = baina.$(obj.nightOn);
		this.nightOff = baina.$(obj.nightOff);
		this.backBtn = baina.$(obj.backBtn);
		this.shareBtn = baina.$(obj.shareBtn);
		this.refreshBtn = baina.$(obj.refreshBtn);
		this.refreshCBtn = baina.$(obj.refreshCBtn);
		this.preSubBtn = baina.$(obj.preSubBtn);
		this.cList = baina.$(obj.cList);
		this.clistWrap = baina.$(obj.clistWrap);
		this.clistHead = baina.$(obj.clistHead);
		this.clistFooter = baina.$(obj.clistFooter);
		this.cPage = baina.$(obj.cPage);
		this.cPageTotal = baina.$(obj.cPageTotal);
		this.clearBtn = baina.$(obj.clearBtn);
		this.sendToDBtn = baina.$(obj.sendToDBtn);
		this.setBtn = baina.$(obj.setBtn);
		this.clistSetPanel = baina.$(obj.clistSetPanel);
		this.exitBtn = baina.$(obj.exitBtn);
		this.addSmall = baina.$(obj.addSmall);
		this.channelWrap = baina.$(obj.channelWrap);
		this.welPanel = baina.$(obj.welPanel);
		this.albumDetail = baina.$(obj.albumDetail);
		this.albumWrap = baina.$(obj.albumWrap);
		this.detailAHead = baina.$(obj.detailAHead);
		this.detailAFoot = baina.$(obj.detailAFoot);
		this.backABtn = baina.$(obj.backABtn);
		this.shareABtn = baina.$(obj.shareABtn);
		this.picBar = baina.$(obj.picBar);
		this.subSection = baina.$(obj.subSection);
		this.subHead = baina.$(obj.subHead);
		this.subList = baina.$(obj.subList);
		this.subListDrag = baina.$(obj.subListDrag);
		this.subDList = baina.$(obj.subDList);
		this.subDListDrag = baina.$(obj.subDListDrag);
		this.subBack = baina.$(obj.subBack);
		this.subOK = baina.$(obj.subOK);
		this.subTitle = baina.$(obj.subTitle);

		this.confirmWrap = baina.$(obj.confirmWrap);
		this.confirmView = baina.$(obj.confirmView);
		this.confirmContent = baina.$(obj.confirmContent);
		this.okBtn = baina.$(obj.okBtn);
		this.cancelBtn = baina.$(obj.cancelBtn);
		this.toast = baina.$(obj.toast);
		
		this.loading = baina.$(obj.loading);
		this.picCardLoading = baina.$(obj.picCardLoading);
		this.textCardLoading = baina.$(obj.textCardLoading);
		this.tipBar = baina.$(obj.tipBar);

		var delChannels = baina.getLocal("delChannels");
		if(typeof delChannels=="string"){
			this.delChannels = JSON.parse(delChannels);
		}

		this.initPos();//先获得this.vW和this.vH
		this.loading.style["display"] = "block";//默认先显示loading

		this.iconPageWidth = this.vW - 50; //iconPage的宽度，50为下一页的预留空间
		window.scrollTo(0,1);

		//更新提示
		//if(!window.dolphin || !window.dolphin.launchWebAppMode){
			//this.showConfirm("为获得更好的阅读体验<br>请下载最新版本的海豚浏览器",
			//function(){
				//location.href = "http://download.dolphin-browser.cn/downloads/apk/CNDolphinBrowser.apk";
			//});
		//}

		baina.addEvent(window,"resize",function(){
			//延迟调用，以免因浏览器尚未完成页面调整而得到错误的页面布局
			setTimeout(function(){tempThis.adjustPos(true);}, 300);
		});
		baina.addEvent(window,"scroll",function(e){tempThis._controlScroll(e);});
		baina.addEvent(window,"DOMContentLoad",function(){tempThis.adjustPos();});
		baina.addEvent(window,"load",function(){
			setTimeout(function(){tempThis.adjustPos();},800);//延时强制调整一下，android垃圾...
		});
		baina.addEvent(window,"hashchange",function(){tempThis.swapStatus();});
		baina.addEvent(window,"beforeunload",function(){tempThis.exitApp();});
		baina.addEvent(window,"orientationchange",function(){
			//延迟调用，以免因浏览器尚未完成页面旋转而得到错误的页面布局
			setTimeout(function(){tempThis.adjustPos();}, 1500);
		});
		
		baina.addEvent(this.listWrap,"touchstart",function(e){tempThis._listTouchStart(e);});
		baina.addEvent(this.listWrap,"touchmove",function(e){tempThis._listTouchMove(e);});
		baina.addEvent(this.listWrap,"touchend",function(e){tempThis._listTouchEnd(e);});
		baina.addEvent(this.listWrap,"click",function(e){tempThis._listClick(e);});
		baina.addEvent(this.backLBtn,"click",function(e){
			tempThis.channelBack(e);
		});
		baina.addEvent(this.refreshBtn,"click",function(){
			//track first，避免影响性能
			baina.track("refresh", "channel", tempThis.displayCat.id, null, null, tempThis.curPage);
			tempThis.refreshChannel();
		});

		baina.addEvent(this.preSubBtn,"click",function(e){
			//订阅预览页面中点击订阅按钮，订阅按钮变为刷新按钮
			var target = e.target;
			tempThis.hideSubBtn();
			var chid = tempThis.displayCat.id;
			var catid = parseInt(target.getAttribute("cat"));
			tempThis.addChannel(target, chid, catid);
			tempThis.showToast("订阅成功");
		});
		//if(baina.supportScroll()){
			//对于支持类似 -webkit-overflow-scrolling 属性的浏览器，上下用自己写的，左右用系统的
			//baina.createStyle("scroll.css","android4");
			//baina.addEvent(this.detailWrap,"touchstart",function(e){tempThis._dScrollStart(e);});
			//baina.addEvent(this.detailWrap,"touchmove",function(e){tempThis._dScrollMove(e);});
			//baina.addEvent(this.detailWrap,"touchend",function(e){tempThis._dScrollEnd(e);});
			//baina.addEvent(this.detailFoot,"touchmove",function(e){e.preventDefault();});
		//}else{
			//不支持类似 -webkit-overflow-scrolling 属性的浏览器，上下左右全部自己写
			baina.addEvent(this.detailWrap,"touchstart",function(e){tempThis._dTouchStart(e);});
			baina.addEvent(this.detailWrap,"touchmove",function(e){tempThis._dTouchMove(e);});
			baina.addEvent(this.detailWrap,"touchend",function(e){tempThis._dTouchEnd(e);});
			baina.addEvent(this.detailWrap,"selectstart",function(e){tempThis._dSelect(e);});
			baina.addEvent(this.detail,"touchmove",function(e){e.preventDefault();});
		//}
		baina.addEvent(this.shareBtn,"click",function(){tempThis.shareToWeibo();});
		baina.addEvent(this.shareABtn,"click",function(){tempThis.shareToWeibo();});
		baina.addEvent(this.backBtn,"click",function(e){
			//track阅读的情况
			tempThis.trackNewsReading();
			//track first，避免影响性能
			if(tempThis.artList){
				var tid = tempThis.artList[tempThis.curIndex].id;
				baina.track("click", "backToChannel", tempThis.displayCat.id, "detailArt", tid);
			}
			tempThis.detailBack(e);
		});
		baina.addEvent(this.backABtn,"click",function(e){
			//track阅读的情况
			tempThis.trackPicReading();
			//track first，避免影响性能
			if(tempThis.artList){
				var tid = tempThis.artList[tempThis.curIndex].id;
				baina.track("click", "backToChannel", tempThis.displayCat.id, "detailArt", tid+"_"+tempThis.curPicIndex);
			}
			tempThis.detailBack(e);
		});
		baina.addEvent(this.addSmall,"click",function(e){
			baina.track("click", "sub", 1, "screen", tempThis.iconCurPage);
		});

		//点击弹窗之外的地方，则弹框消失
		//baina.addEvent(this.confirmWrap,"click",function(e){e.preventDefault();tempThis.hideConfirm();});
		baina.addEvent(this.confirmWrap,"touchmove",function(e){e.preventDefault();});
		//点击弹窗本身不会消失，点击其他地方才消失。
		baina.addEvent(this.confirmView,"click",function(e){e.stopPropagation();});

		baina.addEvent(this.albumDetail,"touchstart",function(e){tempThis._pTouchStart(e);});
		baina.addEvent(this.albumDetail,"touchmove",function(e){tempThis._pTouchMove(e);});
		baina.addEvent(this.albumDetail,"touchend",function(e){tempThis._pTouchEnd(e);});
		baina.addEvent(this.albumWrap,"click",function(){tempThis.toggleAlbumHead();});
		baina.addEvent(this.channelWrap,"touchstart",function(e){tempThis._iconTouchStart(e);});
		baina.addEvent(this.channelWrap,"touchmove",function(e){tempThis._iconTouchMove(e);});
		baina.addEvent(this.channelWrap,"touchend",function(e){tempThis.hideClistPanel();tempThis._iconTouchEnd(e);});
		baina.addEvent(this.channelWrap,"click",function(e){e.preventDefault();e.stopPropagation();});//icon页面的点击通通屏蔽
		baina.addEvent(this.listFooter,"touchmove",function(e){e.preventDefault();});
		baina.addEvent(this.albumDetail,"touchmove",function(e){e.preventDefault();});
		baina.addEvent(this.cList,"touchmove",function(e){e.preventDefault();});
		baina.addEvent(this.cList,"selectstart",function(e){e.preventDefault();});
		baina.addEvent(this.cList,"click",function(e){e.stopPropagation();});
		baina.addEvent(this.cList,"contextmenu",function(e){e.preventDefault();});
		baina.addEvent(this.clearBtn,"click",function(e){e.stopPropagation();tempThis.clearLocalData();});
		baina.addEvent(this.welPanel,"touchend",function(e){e.preventDefault();tempThis.hideWelPanel();});//点击欢迎页面，就隐藏

		baina.addEvent(this.setBtn,"click",function(){tempThis.toggleClistPanel();});
		baina.addEvent(this.clistSetPanel,"touchmove",function(e){e.preventDefault();});//如果不阻止，使用_dScrollMove的会有影响

		baina.addEvent(this.subBack,"click",function(){
			//track first，避免影响性能
			var tHash = baina.lhash();
			if(tHash.match(/^cat\d+$/i)){
				var catId = tHash.slice(3);
				baina.track("click", "backToSub", 1, "channelList", catId);
			}
			tempThis.goToSubList();
		});
		baina.addEvent(this.subOK,"click",function(){
			//track first，避免影响性能
			var tHash = baina.lhash();
			if(tHash.match(/^cat\d+$/i)){
				var catId = tHash.slice(3);
				baina.track("click", "confirm", 1, "channelList", catId);
			}else{
				baina.track("click", "confirm", 1, "subCatList", 1);
			}
			tempThis.channelBack();
		});
		this.listDrag = new baina.touchSet({tTarget:this.subListDrag,outerH:this.subList,scrollToTop:true});
		this.DListDrag = new baina.touchSet({tTarget:this.subDListDrag,outerH:this.subDList,scrollToTop:true});
		baina.addEvent(this.subDListDrag,"click",function(e){tempThis.channelToggle(e);});
		
		baina.addEvent(this.homeBtn,"click",function(){
			//detail页面中回到主页的按钮
			baina.track("click", "backToScreen", this.iconCurPage, "channel", tempThis.displayCat.id, tempThis.curPage);
			location.hash = "";
		});
		baina.addEvent(this.homeABtn,"click",function(){
			//图集页面中回到主页的按钮
			baina.track("click", "backToScreen", this.iconCurPage, "channel", tempThis.displayCat.id, tempThis.curPage);
			location.hash = "";
		});
		baina.addEvent(this.settingBtn,"touchend",function(){tempThis.toggleSettingPanel();});
		baina.addEvent(this.settingPanel,"touchend",function(){tempThis.hideSettingPanel();});
		baina.addEvent(this.settingPanel,"touchmove",function(e){e.preventDefault();});//如果不阻止，使用_dScrollMove的会有影响
		baina.addEvent(this.loading,"touchmove",function(e){e.preventDefault();});//loading出来的时候，也阻止一下
		baina.addEvent(this.bsetting,"click",function(e){e.stopPropagation();});//这个部分的点击，不要冒泡到上面
		baina.addEvent(this.bsetting,"touchend",function(e){e.stopPropagation();});
		baina.addEvent(this.sfont,"touchend",function(){tempThis.toggleFont();});
		baina.addEvent(this.snight,"touchend",function(){tempThis.toggleNight();});

		//卡片模板相关
		baina.addEvent(this.cards,"touchmove",function(e){e.preventDefault();});
		baina.addEvent(this.switchBtn,"click",function(){tempThis.togglePicMode();});//无图与有图模式的切换
		baina.addEvent(this.backCBtn,"click",function(e){tempThis.channelBack(e);});
		baina.addEvent(this.refreshCBtn,"click",function(){
			//track first，避免影响性能
			baina.track("refresh", "channel", tempThis.displayCat.id, null, null, tempThis.curPage);
			tempThis.refreshChannel();
		});
		this.picDrag = new baina.touchSet({
			tTarget:this.picWrap,
			outerH:this.cardsWrap,
			scrollToTop:true,
			scrollEnd:function(){tempThis.loadingMore();}
		});
		this.noPicDrag = new baina.touchSet({
			tTarget:this.noPicWrap,
			outerH:this.cardsWrap,
			scrollToTop:true,
			scrollEnd:function(){tempThis.loadingMore();}
		});

		this.checkVer();//检测一下版本，如果版本不对，则强制清除所有缓存，这个主要用于特别大的升级，平常不需要修改baina.js中的版本

		var lastDuration = baina.getLocal("reader-duration");
		if(lastDuration){
			//track上一次的会话时长
			baina.track("stay", "duration", lastDuration);
		}

		var tValuse = baina.getLocal("sValues");
		if(tValuse){
			this.sValues = JSON.parse(tValuse);
		}
		if(this.sValues.bigFont){
			//大字体模式
			this.bigFontOn();
		}
		if(this.sValues.nightMode){
			//夜间模式
			this.nightModeOn();
		}
		
		var tHash = baina.lhash();
		if(tHash.match(/^detail\d+$/i)){
			//直接显示detail
			this.hArray.push("detail");//管理历史记录
			this.initArticle();
		}else if(tHash.match(/^album\d+$/i)){
			this.hArray.push("album");
			this.initAlbum();
		}else if(tHash.match(/^ch\d+$/i)){
			//某个频道的具体channel界面
			this.hArray.push("channel");
			this.initChannel();
		}else if(tHash.match(/^subscribe$/i)){
			//订阅分类
			this.hArray.push("subscribe");
			this.initSubscribe();
		}else if(tHash.match(/^cat\d+$/i)){
			//订阅list（各个分类下的频道）
			this.hArray.push("sublist");
			this.listSub();
		}else{
			//其它情况选择频道的页面
			this.hArray.push("chlist");
			this.listChannel();
			if (this.hasWelPanel) {
				//这里初始化，需要一个welcome的图片
				this.welPanel.style["display"] = "block";
				var tImg = new Image();
				tImg.src = "images/wel.jpg";
				tImg.onload = function(){
					//welcome的图片加载成功后，再延时隐藏
					setTimeout(function(){tempThis.hideWelPanel();},2500);//2.5秒之后，隐藏welcome画面
				}
			}
		}
		//加载背景图片
		var bgImg = new Image();
		bgImg.src = "images/chbg.jpg";
		bgImg.onload = function(){
			tempThis.cList.style["background-image"] = "url(images/chbg.jpg)";
		}

		//发送到桌面按钮
		if(window.dolphin && window.dolphin.createShortcut){
			baina.addEvent(this.sendToDBtn,"click",function(e){
				e.stopPropagation();
				tempThis.hideClistPanel();
				tempThis.sendToDesktop();
			});
		}else{
			this.sendToDBtn.style["display"] = "none";
		}

		//退出当前webapp页面按钮
		if(window.dolphin && window.dolphin.backToPreNormalPage){
			baina.addEvent(this.exitBtn,"click",function(e){
				e.preventDefault();
				baina.track("click", "exitApp", 1, null, null, tempThis.iconCurPage, true);
				var url = window.location.href;
				window.dolphin.backToPreNormalPage(url);
			});
		}else{
			baina.addEvent(this.exitBtn,"click",function(e){
				e.preventDefault();
				baina.track("click", "exitApp", 1, null, null, tempThis.iconCurPage, true);
				history.back();
			});
		}
	},
	initPos : function(){
		//专门调整loading位置的，主要是loading出现比较早，需要先调整
		this.vW = baina.viewData().viewWidth;
		this.vH = baina.viewData().viewHeight;
		if(!this.vW){this.vW = 320;}//某些android在启动的时候，预加载过快，会导致这个值取得0
		if(!this.vH){this.vH = 480;}
		//130和40分别为loading的宽、高，display:none的时候，offsetWidth不生效，为0
		this.loading.style["left"] = (this.vW - 130)/2 + "px";
		this.loading.style["top"] = (this.vH - 40)/2 + "px";
		//284和150分别为confirm的宽、高.
		this.confirmView.style["left"] = (this.vW - 284)/2 + "px";
		this.confirmView.style["top"] = (this.vH - 150) * 2/5 + "px";
	},
	adjustListPic : function(){
		//调整list的图片尺寸
		var pics = this.listWrap.getElementsByTagName("img");
		for(var j=0,k=pics.length;j<k;j++){
			baina.adjustListPic(pics[j],true);
		}
	},
	iconPosition : function(){
		//icon相关的
		var aWidth = this.vW - 90;//水平方向可用宽度，左边的空隙按照20计算，右边按钮们按照70计算，共90
		var aHeight = this.vH - this.hMargin;//竖直方向可用高度，上边的空隙初始按照15计算
		//下面计算出水平方向、竖直方向分别可以放几个
		this.hNum = Math.floor(aWidth/this.iconWidth);
		this.vNum = Math.floor(aHeight/this.iconWidth);
		if(this.hNum<1){
			this.hNum = 1;
		}
		if(this.vNum<1){
			this.vNum = 1;
		}
		//this.hMargin = Math.floor((this.vH-this.vNum*110)/2);//动态计算一下顶部的空隙值，让icon整体居中
		//if(this.hMargin<0){
			//this.hMargin = 0;
		//}
		this.eachPageNum = this.hNum * this.vNum;//每页最多可以放几个
	},
	iconPosition2 : function(){
		//icon相关的
		var aWidth = this.vW - 78;//水平方向可用宽度，iconPage的宽度为this.vW - 50，左边的空隙28，合计88
		var aHeight = this.vH - 155 + 1;//竖直方向可用高度，上边的空隙初始按照15计算，同时计算上下的边距;80是this.clistHead.offsetHeight，45是this.clistFooter.offsetHeight;合计155
		//确定横竖屏下的水平垂直数量
		if (aHeight > aWidth){
			this.hNum = 2;
			this.vNum = 3;
		} else {
			this.hNum = 3;
			this.vNum = 2;
		}
		//下面计算出水平方向、竖直方向可用的元素宽度
		var eachWidth = Math.floor(aWidth/this.hNum) - 15;
		var eachHeight = Math.floor(aHeight/this.vNum) - 15;

		var width = Math.min(eachWidth, eachHeight);
		if(width < 100){
			this.iconPadding = 0;
		} else {
			this.iconPadding = Math.floor((width - 100)/2);
		}
		this.iconWidth = 115 + 2*this.iconPadding;
		this.eachPageNum = 6;//每页固定放6个

		//动态计算一下顶部的空隙值，让icon整体居中
		this.hMargin = Math.floor((aHeight-this.vNum*this.iconWidth+15)/2);
	},
	adjustPos : function(donotScroll){
		if(!donotScroll){
			//如果没有设置不滑动，则往上滑动了
			window.scrollTo(0,1);
		}
		this.initPos();
		
		//调整newslist的位置，当前不是news相关的页面
		if(!this.channelMode && !this.detailNewsMode && !this.detailAlbumMode){
			baina.setTransition(this.newslist,"");
			baina.setTransform(this.newslist,0,(this.vH+1));
		}
		
		
		//调整newslist的位置，当前不是news相关的页面
		if(!this.channelMode && !this.detailNewsMode && !this.detailAlbumMode){
			baina.setTransition(this.newslist,"");
			baina.setTransform(this.newslist,0,(this.vH+1));
		}
		
		if(this.displayCat.dt){
			//图集
			this.listWrap.style["height"] = this.vH - 40 + 1 + "px";//这里高度多加1，因为scrollTo(0,1)，底部会有1px的空隙。this.listFooter.offsetHeight的高度是40。图集的listHead高度为0
		}else{
			this.listWrap.style["height"] = this.vH - 80 + 1 + "px";//这里高度多加1，因为scrollTo(0,1)，底部会有1px的空隙。this.listFooter.offsetHeight的高度是40。this.listHead.offsetHeight为40
		}
		this.listWrap.style["width"] = this.vW + "px";
		//调整各个新闻list页面的位置
		var lPages = this.listWrap.getElementsByClassName("pageWrap");
		for(var i=0,l=lPages.length;i<l;i++){
			var tNum = lPages[i].getAttribute("page");
			if(tNum==this.curPage-1){
				baina.setTransform(lPages[i],-this.vW,0);
			}else if(tNum==this.curPage+1){
				baina.setTransform(lPages[i],this.vW,0);
			}
		}
		this.adjustListPic();//调整list的图片尺寸
		
		//调整卡片模板：段子
		this.cards.style["width"] = this.vW + "px";
		this.cards.style["height"] = this.vH + "px";
		this.cardsWrap.style["width"] = this.vW + "px";
		this.cardsWrap.style["height"] = this.vH - 83 + "px";//head高度40px；footer高度43px;

		//调整卡片模板的位置
		if(!this.channelMode){
			baina.setTransition(this.cards,"");
			baina.setTransform(this.cards,0,(this.vH+1));
		}

		//调整detail部分
		if(!this.detailNewsMode){
			baina.setTransition(this.detail,"");
			baina.setTransform(this.detail,0,(this.vH+1));
		}else{
			this.wrapView.style["height"] = this.vH + 1 + "px";
		}
		this.detailWrap.style["height"] = this.vH - 40 + 1 + "px";//this.detailFoot.offsetHeight + "px";//detailFoot在display:none的时候拿不到高度 ////这里高度多加1，因为scrollTo(0,1)，底部会有1px的空隙
		this.detailWrap.style["width"] = this.vW + "px";
		this.settingPanel.style["width"] = this.vW + "px";
		this.settingPanel.style["height"] = this.vH - 40 + 1 + "px";
		//调整各个文章的位置
		var lArts = this.detailWrap.getElementsByClassName("artWrap");
		for(var i=0,l=lArts.length;i<l;i++){
			var tIndex = lArts[i].getAttribute("index");
			if(tIndex==this.curIndex-1){
				baina.setTransform(lArts[i],-this.vW,0);
			}else if(tIndex==this.curIndex+1){
				baina.setTransform(lArts[i],this.vW,0);
			}
		}
		
		//调整订阅部分
		this.cList.style["width"] = this.vW + "px";
		this.clistWrap.style["height"] = this.vH - 45 + 2 + "px";//80是this.clistHead.offsetHeight，45是this.clistFooter.offsetHeight
		this.channelWrap.style["height"] = this.vH - 45 + 2 + "px";//这里高度多加1，因为scrollTo(0,1)，底部会有1px的空隙。android机器比较垃圾，大的屏幕，底下会有多余1px（少于2px），所以这个地方多处理一个1px，其余地方不变
		this.channelWrap.style["width"] = this.vW + "px";
		this.iconPageWidth = this.vW - 50; //iconPage的宽度，50为下一页的预留空间
		
		//调整各个图集list页面的位置
		var lPages = this.listWrap.getElementsByClassName("pageAWrap");
		for(var i=0,l=lPages.length;i<l;i++){
			var tNum = lPages[i].getAttribute("page");
			if(tNum==this.curPage-1){
				baina.setTransform(lPages[i],-this.vW,0);
			}else if(tNum==this.curPage+1){
				baina.setTransform(lPages[i],this.vW,0);
			}
		}
		//图集detail部分
		if(!this.detailAlbumMode){
			baina.setTransition(this.albumDetail,"");
			baina.setTransform(this.albumDetail,0,(this.vH+1));
		}
		this.albumWrap.style["height"] = this.vH + 1 + "px";//这里高度多加1，因为scrollTo(0,1)，底部会有1px的空隙
		this.albumWrap.style["width"] = this.vW + "px";
		//调整各个图片的位置
		var lArts = this.albumWrap.getElementsByClassName("artAWrap");
		for(var i=0,l=lArts.length;i<l;i++){
			var tIndex = lArts[i].getAttribute("index");
			var tPIndex = lArts[i].getAttribute("pindex");
			if((tIndex==this.curIndex && this.curPicIndex>0 && tPIndex==this.curPicIndex-1)||(tIndex==this.curIndex-1 && this.curPicIndex==0)){//这里不需要判断这么严格的判断
				baina.setTransform(lArts[i],-this.vW,0);
			}else if((tIndex==this.curIndex && this.curPicIndex<this.curListLen-1 && tPIndex==this.curPicIndex+1)||(tIndex==this.curIndex+1 && this.curPicIndex==this.curListLen-1)){
				baina.setTransform(lArts[i],this.vW,0);
			}
		}
		var pics = this.albumWrap.getElementsByTagName("img");
		for(var j=0,k=pics.length;j<k;j++){
			//调整图集detail的图片尺寸
			baina.adjustAlbumPic(pics[j]);
		}
		if(this.curPicIndex>=0 && this.curListLen){
			this.picBar.style["width"] = parseInt(this.vW*(this.curPicIndex+1)/this.curListLen) + "px";
		}
		
		//订阅部分
		this.subSection.style["height"] = this.vH + 1 + "px";
		this.subSection.style["width"] = this.vW + "px";
		this.subList.style["width"] = this.vW + "px";
		this.subList.style["height"] = this.vH - 40 + 1 + "px";//subHead的高度是40，display为none的时候取不到
		this.subDList.style["width"] = this.vW + "px";
		this.subDList.style["height"] = this.vH - 40 + 1 + "px";//subHead的高度是40，display为none的时候取不到
		if(!this.subListMode && !this.subDListMode){
			baina.setTransition(this.subSection,"");
			baina.setTransform(this.subSection,0,(this.vH+2));
		}
		if(this.subDListMode){
			baina.setTransform(this.subList,-this.vW,0);
			//baina.setTransform(this.subDList,0,0);
		}else{
			//baina.setTransform(this.subList,0,0);
			baina.setTransform(this.subDList,this.vW,0);
		}

		if(this.iconMode){
			//每次调整位置，若处于编辑状态，则推出编辑状态
			this.quitIconMode();
		}
		this.adjustIconPos();//调整icons的位置
	},
	showChannel : function(){
		//track阅读的信息
		if(this.artStartTiming){
			this.trackNewsReading();
		}else if(this.picReadCount){
			this.trackPicReading();
		}

		//判断是list模板还是卡片模板
		//默认是list模板
		var target = this.newslist;
		if(this.displayCat.dt==4){//卡片模板
			target = this.cards;
		}
		var tempThis = this;
		target.style["display"] = "block";
		this.channelMode = true;
		setTimeout(function(){
			baina.setTransition(target,"-webkit-transform 0.5s ease");
			baina.setTransform(target,0,0);
		},5);
		baina.track("pageView", "channel", this.displayCat.id);
	},
	hideChannel : function(){
		var tempThis = this;
		this.channelMode = false;

		//判断是list模板还是卡片模板
		//默认是list模板
		var target = this.newslist;
		if(this.displayCat.dt==4){//卡片模板
			target = this.cards;
		}
		if(this.channelListMode){
			//在channel list状态下滑出当前页面
			baina.setTransform(target,0,(this.vH+2));
		}
		setTimeout(function(){
			//延时一下，这样动画的过程中还能看到channel页面的东西
			if(!tempThis.channelMode){
				target.style["display"] = "none";//把channel隐藏
			}
		},750);
	},
	initChannel : function(){
		//初始化具体的频道列表
		var tempThis = this;
		var lhash = baina.lhash();
		if(/^ch\d+$/i.test(lhash)){
			this.displayCat.id = lhash.slice(2);
		}
		this.getLocalData();//获取本地的数据，主要是用于直接进入list的情况
		this.listOK = true;//channelList已经弄过了
		var hasLData;//是否有本地数据
		var hasMatch = false;//Categories里面是否有匹配的displaycat信息
		var lChannel = baina.getLocal("channels");//取出本地缓存中的频道列表
		if(lChannel){
			lChannel = JSON.parse(lChannel);
			this.Categories = lChannel.Categories;
			if(this.displayCat.id!=undefined){
				//用户在地址栏输入了一个chid，做匹配
				for(var i=0,l=this.Categories.length;i<l;i++){
					if(this.displayCat.id==this.Categories[i].id){
						this.displayCat = this.Categories[i];
						hasMatch = true;
						break;
					}
				}
			}
			if(hasMatch){
				//有时候本地的数据出错，导致channelLocal正确执行，但是值是空的
				hasLData = true;
				this.showChannel(); //如果有缓存则先显示
				this.manageChannel();//直接显示本地的数据
				return false;
			}else if(!this.Categories || this.Categories.length<=0){
				hasLData = false;
				this.Categories = [];//归位，否则可能变成undefined
				this.clearNewsLocal();//如果出现数据错误的情况，把缓存中的channel/news数据都清除掉
			}else{
				//这种情况就是有本地的频道信息，但是跟displayCat的id没有匹配的。说明是手动输入的url
				hasLData = true;
			}
		}else{
			hasLData = false;
		}
		
		if(!hasLData){
			//没有本地数据，全新的请求
			this.dataPosition = "new";
			var url = baina.url + "sub/init" + "?rs="+this.newsNum*this.pages+"&t=" + baina.refreshT() + baina.netWorkType();
			if(/^ch\d+$/i.test(lhash)){
				//如果用户指定了频道id
				url += "&chid=" + lhash.slice(2);
			}
			this.showLoading();
			
			baina.ajaxGet(encodeURI(url),function(text){
				tempThis.manageChannel(text);
				tempThis.adjustPos();
			},function(text){tempThis.manageChannel(text);});
		}else{
			//有本地数据，但走到这个分支了，表明displayCat.id没有匹配到，是用户手动输入的
			this.requestList(true);//请求频道数据，并带上tp=1的参数
		}
	},
	manageChannel : function(text,local){
		//初始化的时候，处理频道信息（当用户首次进入，就是频道#ch的情况
		var tempThis = this;
		if(text){
			var tResponse;
			if(typeof text=="string" && (text.slice(0,10).toLowerCase().match("<html") || text.slice(0,10).toLowerCase().match("<!doctype"))){
				//数据返回错误的时候，常常返回一个html页面...所以只能这样判断
				this.hideLoading();//隐藏loading
				this.showTip("服务器故障，请稍后重试");
				return false;
			}else if(local==undefined){
				tResponse = JSON.parse(text);
				if(tResponse.sta!=undefined && tResponse.sta==0){
					for(var i=0,l=tResponse.defsrc.length;i<l;i++){
						//频道列表
						this.Categories[i] = {id:tResponse.defsrc[i].chid,name:tResponse.defsrc[i].chname,cov:tResponse.defsrc[i].cov,dt:tResponse.defsrc[i].dt,chtype:tResponse.defsrc[i].chtype,move:tResponse.defsrc[i].movable};
						if(tResponse.chid == tResponse.defsrc[i].chid){
							//当前显示的频道记录一下
							this.displayCat = this.Categories[i];
							this.curChannel();//显示本地频道的相关东西
						}
					}
					this.showChannel();
					if(this.displayCat.dt!=4){
						//如果不是卡片模板
						if(this.displayCat.dt==1){
							var lPages = this.listWrap.getElementsByClassName("pageAWrap");
						}else if(this.displayCat.dt==0){
							var lPages = this.listWrap.getElementsByClassName("pageWrap");
						}
						var toBeDel = [];//需要删除的元素
						for(var i=0,l=lPages.length;i<l;i++){
							lPages[i].style["display"] = "none";//隐藏不在范围内的DOM
							toBeDel.push(lPages[i]);
						}
						for(var i=0,l=toBeDel.length;i<l;i++){
							//list中的div，全部删掉重来。这里之所以要这样处理，是因为直接进入detail，左右滑动加载了新的文章，有了div，这个时候返回list，不删掉就不对应了
							baina.delNode(toBeDel[i]);
						}
					}

					if(tResponse.docs != undefined && tResponse.docs.length){
						//直接把数据传给新闻处理函数来处理
						//这里需要处理一下，因为请求之前，并不知道dt是多少
						var cutLen = 0;
						if(tResponse.dt==1){
							cutLen = tResponse.docs.length%this.picNum;
						}else if(tResponse.dt==0){
							cutLen = tResponse.docs.length%this.newsNum;
						}else if(tResponse.dt==4){
							//段子
							cutLen = tResponse.docs.length%this.cardsNum;
						}
						if(cutLen){
							tResponse.docs = tResponse.docs.slice(0,-cutLen);
						}
						this.manageList(JSON.stringify({
							chid : this.displayCat.id,
							chname : this.displayCat.name,
							sta : 0,
							docs : tResponse.docs
						}));
					}else if(this.channelMode){
						//在具体频道的列表下
						this.hideLoading();//隐藏loading
						this.showTip(this.displayCat.chname + "暂无数据，请稍后重试");
						return false;
					}
				}else if(tResponse.sta!=undefined && tResponse.sta==-7){
					//tResponse.sta==-7表示该频道已下线
					this.hideLoading();
					this.showTip("频道已下线");
					return false;
				}else{
					this.hideLoading();//隐藏loading
					this.showTip("请求数据出错，请稍后重试");
					return false;
				}
			}
		}else{
			this.curChannel();//显示本地频道的相关东西
			this.requestList();//如果是直接调用的（例如有本地缓存），请求具体频道
		}
		this.channelLocal();//频道信息保存到本地
		if(this.channelWrap.innerHTML.length<10){
			this.createCList();//创建icon的列表，这样返回icon列表页面的时候就不用再请求了
		}
	},
	curChannel : function(){
		//当前频道的相关操作
		if(this.displayCat.dt==4){
			//卡片模板：搞笑段子
			this.cardsTitle.innerHTML = this.displayCat.name;
		}else if(this.displayCat.dt==0){
			//新闻的题头
			this.listHead.innerHTML = "<div class='blueline'></div><span class='text'>"+this.displayCat.name+"</span>";
			this.listHead.style["height"] = "40px";
		}else if(this.displayCat.dt==1){
			//图集
			this.listHead.innerHTML = "";
			this.listHead.style["height"] = "0";
		}
		this.curPage = 0;
		this.adjustPos();//因为listHead变了，所以需要调整一下
	},
	channelLocal : function(obj){
		//各个频道的数据，保存到本地
		var tChannel;
		if(obj){
			tChannel = obj;
		}else{
			tChannel = baina.getLocal("channels");
			if(tChannel){
				tChannel = JSON.parse(tChannel);
				tChannel.displayCat = this.displayCat;
				tChannel.Categories = this.Categories;
				tChannel.iPageLen = this.iPageLen;
				if(this.iconCurPage!=undefined){
					tChannel.iconCurPage = this.iconCurPage;//icon的页面，位于第几页
				}
			}else{
				tChannel = {"displayCat":this.displayCat,"Categories":this.Categories};
			}
		}
		baina.setLocal("channels",JSON.stringify(tChannel));
	},
	requestList : function(notInCat){
		//请求具体频道的新闻list
		var tempThis = this;
		var lList = this.getNewsLocal();
		this.listOK = true;//list已经弄过了
		var hasLData = false;//是否有本地数据
		if(lList && !notInCat){
			//如果需要走tp=1的，也就是频道不在Categories里面的，通通不走这个分支
			lList = JSON.parse(lList);
			var lData = lList.data;
			var reTime = lList.rT;//上次刷新的时间		
			if(lData && lData.length){
				//如果数据存在，并且是对的
				//确保显示本地的是整屏幕，因为直接进入detail的情况，再左右滑动，可能导致混乱
				if((this.displayCat.dt==1 && lData.length>=this.picNum) || (this.displayCat.dt==0 && lData.length>=this.newsNum)){
					var cutLen = this.displayCat.dt==1 ? lData.length%this.picNum : lData.length%this.newsNum;
					if(cutLen){
						this.delLocalDetail(lData.slice(-cutLen));//把多出来的这部分，如果请求过detail的，删掉
						lData = lData.slice(0,-cutLen);
					}
					this.newsLocal(this.displayCat.id,lData,reTime,0);
					if(this.displayCat.dt==4){
						//搞笑段子
						this.showCardsPage(lData);
					}else{
						this.showCurPage(lData);//先显示本地的
					}
					hasLData = true;
					this.dataPosition = "left";
					if(Date.now()-reTime>2000){
						//2秒之内不得重复请求
						var firstId = lData[0].sort ? lData[0].sort : lData[0].id;
						this.requestLeft = true;//结果返回前，不能再发起top的请求
						var tempPath = this.displayCat.dt==4 ? "/contents" : "/docs";
						var url = baina.url + "sources/"+this.displayCat.id+tempPath + "?si=" + firstId + "&t=" + baina.refreshT() + baina.netWorkType();
						if(this.displayCat.dt==1){
							//图集
								url += "&rs=" + this.picNum*this.pages;		
						}else if(this.displayCat.dt==0){
							//新闻
							url += "&rs=" + this.newsNum*this.pages;
						}else if(this.displayCat.dt==4){
							//段子
							url += "&rs=" + this.cardsNum;
							var pic = this.picOff==true ? 0 : 1;
							url += "&pic=" + pic;
						}
						if(notInCat){
							//如果请求的频道不在Categories里面，表明是用户手动输入的url
							url += "&tp=1";
						}
						baina.ajaxGet(encodeURI(url),function(text){
							tempThis.manageList(text);
							tempThis.adjustPos();
						},function(text){tempThis.manageList(text);});
					}
					return false;
				}
			}

			//如果出现数据错误的情况，把缓存中的数据都清除掉
			hasLData = false;
			baina.clearLocal("news"+this.displayCat.id);
		}
		
		if(!hasLData){
			this.dataPosition = "new";
			var tempPath = this.displayCat.dt==4 ? "/contents" : "/docs";
			var url = baina.url + "sources/"+this.displayCat.id+tempPath + "?t=" + baina.refreshT() + baina.netWorkType();
			if(this.displayCat.dt==1){
				//图集
				url += "&rs=" + this.picNum*this.pages;		
			}else if(this.displayCat.dt==0){
				//新闻
				url += "&rs=" + this.newsNum*this.pages;
			}else{
				//段子
				url += "&rs=" + this.cardsNum;
				var pic = this.picOff==true ? 0 : 1;
				url += "&pic=" + pic;
			}
			if(notInCat){
				//如果请求的频道不在Categories里面，表明是用户手动输入的url
				url += "&tp=1";
			}
			this.showLoading();
			baina.ajaxGet(encodeURI(url),function(text){
				tempThis.manageList(text);
				tempThis.adjustPos();
			},function(text){tempThis.manageList(text);});
		}else{
			this.showTip("异常，请清除浏览器缓存再试");
		}
	},
	manageList : function(text,local,fromdetail){
		//处理新闻列表
		var tempThis = this;
		var newsList = [];
		var tResponse;
		if(text){
			if(typeof text=="string" && (text.slice(0,10).toLowerCase().match("<html") || text.slice(0,10).toLowerCase().match("<!doctype"))){
				//数据返回错误的时候，常常返回一个html页面...所以只能这样判断
				this.hideLoading();//隐藏loading
				this.hideCardsLoading();  //隐藏卡片模板的loading
				this.showTip("服务器故障，请稍后重试");
				return false;
			}else if(!local){
				tResponse = JSON.parse(text);
				if(tResponse.sta != undefined && tResponse.sta==0){
					if(tResponse.chid!=undefined && tResponse.chid==this.displayCat.id){
						//返回的数据，必须是当前频道的。避免用户多次点击不同频道，返回数据与当前频道不符合
						newsList = tResponse.docs;//文章取出来
						if(tResponse.cover!==undefined){
							//tp=1过来的数据，添加这个频道到Categories中
							var hasFind = false;
							for(var i=0,l=this.Categories.length;i<l;i++){
								if(this.Categories[i].id==tResponse.chid){
									//这个频道居然曾经被添加过，太荒谬了...
									hasFind = true;
									break;
								}
							}
							if(!hasFind){
								var tCh = {id:tResponse.chid,name:tResponse.chname,cov:tResponse.cover,dt:tResponse.dt,iconPos:{},chtype:tResponse.chtype,movable:tResponse.movable};
								this.displayCat = tCh;
								this.showChannel();//用户直接输入url，走到这才知道dt
								this.curChannel();//显示本地频道的相关东西，因为之前可能都不知道dt的值
							}
						}
					}else{
						//这里应该修改，即使频道不对，数据不能浪费，应该放到缓存storage中
						return false;
					}
				}else if(tResponse.sta != undefined && tResponse.sta==-7){
					//该频道已下线
					this.hideLoading();//隐藏loading
					this.hideCardsLoading();  //隐藏卡片模板的loading
					this.showTip("频道已下线");
					return false;
				}else{
					this.hideLoading();//隐藏loading
					this.hideCardsLoading();  //隐藏卡片模板的loading
					this.showTip("数据出错了，请稍后重试");
					return false;
				}
			}else if(local){
				newsList = text;
			}
		}
		
		var tData = this.getNewsLocal() || [];
		var oldData=[],oldTime=0;
		if(typeof tData == "string"){
			tData = JSON.parse(tData);
			oldTime = tData.rT;
			oldData = tData.data;
		}
		var fullList = oldData;
		var eachRNum = 30;//每次请求的篇数 eachRequestNumber
		if(tResponse.dt==1){
			eachRNum = this.picNum*this.pages;
		}else if(tResponse==0){
			eachRNum = this.newsNum*this.pages;
		}
		if(this.dataPosition == "left"){
			if(newsList.length >= eachRNum){
				//如果取新数据，取回来超过eachRNum条，则认为用户很久没更新了，当做是新刷入一个列表，走new的逻辑
				this.dataPosition = "new";
				this.clearListDiv();
			}else if(newsList.length > 0){
				fullList = newsList.concat(oldData);
				//为了保证显示出来的都正好是一整屏，当有新数据过来的时候，需要删掉末尾的一些老数据
				var tMaxLen = 0;//允许的最大长度
				if(tResponse){
					if(tResponse.dt==1){
						tMaxLen = this.maxPages*this.picNum;
					}else if(tResponse.dt==0){
						tMaxLen = this.maxPages*this.newsNum;
					}else if(tResponse.dt==4){
						tMaxLen = 60;
					}
				}else{
					if(this.displayCat.dt==1){
						tMaxLen = this.maxPages*this.picNum;
					}else if(this.displayCat.dt==0){
						tMaxLen = this.maxPages*this.newsNum;
					}else if(this.displayCat.dt==4){
						tMaxLen = 60;
					}
				}
				if(fullList.length > tMaxLen){
					fullList = fullList.slice(0,tMaxLen);//截断一下，最多就只允许这么多篇
				}
				if(!this.dNoList){
					var cutLen = tResponse.dt==1 ? fullList.length%this.picNum : fullList.length%this.newsNum;
					if(cutLen){
						this.delLocalDetail(fullList.slice(-cutLen));//把多出来的这部分，如果请求过detail的，删掉
						fullList = fullList.slice(0,-cutLen);
					}
				}else{
					//在直接进入detail的模式下，左请求。那么curIndex的值应该做相应调整
					this.curIndex = newsList.length;
					if(this.curArtDiv){
						this.curArtDiv.setAttribute("index",this.curIndex);//修改一下当前文章的位置信息
					}
					if(this.curPicDiv){
						this.curPicDiv.setAttribute("index",this.curIndex);//修改一下当前图片的位置信息
					}
				}
				this.clearListDiv();//清空一下本来的div，保证新的新闻、图集能够显示出来
			}//else if(this.dNoList){
				//this.showTip("第一篇啦");
			//}
			this.requestLeft = false;//这个时候可以再次请求左侧数据了
		}else if(this.dataPosition == "right"){
			if(newsList.length > 0){
				fullList = oldData.concat(newsList);
				this.requestRight = false;
				//this.showTip("加载了"+newsList.length+tTip);
			}else{
				this.showTip("没有更多新闻了");
			}
			this.pageNum.className = "";//loading的标识消失
		}
		
		if(this.dataPosition == "new"){
			if(newsList.length>0){
				if(tResponse.dt==1){
					if(newsList.length<this.picNum){
						newsList = [];//不满一屏的，删掉
					}else{
						var cutLen = newsList.length%this.picNum;
						if(cutLen){
							newsList = newsList.slice(0,-cutLen);//截断，只显示整屏
						}
					}
				}else if(tResponse.dt==0){
					if(newsList.length<this.newsNum){
						newsList = [];//不满一屏的，删掉
					}else{
						var cutLen = newsList.length%this.newsNum;
						if(cutLen){
							newsList = newsList.slice(0,-cutLen);//截断，只显示整屏
						}
					}
				}
				this.delLocalDetail(oldData);//老数据的detail统统删掉
				fullList = newsList;
				if(newsList.length<=0){
					this.showTip("暂无数据，请稍后再试");
				}
			}else{
				this.showTip("暂无数据，请稍后再试");
			}
			this.requestLeft = false;//可以请求顶部数据了
			this.requestRight = false;//滑动到右侧，可以请求数据啦
		}
		this.hideLoading();//隐藏loading
		
		if(!fromdetail){
			//数据请求有可能来自list，也可能来自detail，如果来自detail，则不显示
			if(this.displayCat.dt==4){
				//搞笑段子
				if(this.dataPosition == "left" || this.dataPosition == "new"){
					this.showCardsPage(fullList);
				}else{
					//如果是请求下一页，则直接传newslist添加到后面
					this.showCardsPage(newsList);
				}
			}else{
				this.showCurPage(fullList);
			}
		}
		if(local==undefined && newsList.length>0){
			//写localstorage
			if(this.dataPosition == "left" || this.dataPosition == "new"){
				var tTime = Date.now();
				
				this.newsLocal(tResponse.chid,fullList,tTime,this.curPage);
			}else{
				this.newsLocal(tResponse.chid,fullList,oldTime,this.curPage);
			}
		}
	},
	preloadList: function(chid){
		//若用户添加一个频道，则为他预先加载前5页
		var tempThis = this;
		var lList = this.getNewsLocal();
		if(!lList){
			var tempPath = this.displayCat.dt==4 ? "/contents" : "/docs";
			var url = baina.url + "sources/"+chid+tempPath + "?t=" + baina.refreshT() + baina.netWorkType();
			if(this.displayCat.dt==1){
				//图集
				url += "&rs=" + this.picNum*this.pages;		
			}else if(this.displayCat.dt==0){
				//新闻
				url += "&rs=" + this.newsNum*this.pages;
			}else if(this.displayCat.dt==4){
				//段子
				url += "&rs=" + this.cardsNum;
				var pic = this.picOff==true ? 0 : 1;
				url += "&pic=" + pic;
			}
			//如果请求的频道不在Categories里面，表明是用户手动输入的url
			url += "&tp=1";
			baina.ajaxGet(encodeURI(url),function(text){
				var tResponse = JSON.parse(text);
				var fullList = tResponse.docs;
				var tTime = Date.now();
				tempThis.newsLocal(chid,fullList,tTime,0);
			});
		}
	},
	newsLocal : function(chid,fullList,reTime,curPage){
		//把list数据存到本地
		if(this.displayCat.dt == 4){
			//段子的缓存数据
			var cardsData = {rT:reTime,data:fullList,cP:curPage};
			var pic = this.picOff ? "text" : "pic";
			baina.setLocal("cards-"+pic+chid,JSON.stringify(cardsData));
			return;
		}
		var newslistData = {rT:reTime,data:fullList,cP:curPage};
		baina.setLocal("news"+chid,JSON.stringify(newslistData));
	},
	getNewsLocal : function(){
		var localData = null;
		if(this.displayCat.dt==4){
			//如果是段子，则需要考虑是去取无图的还是有图的数据
			var pic = this.picOff ? "text" : "pic";
			localData = baina.getLocal("cards-"+pic+this.displayCat.id);
		}else{
			localData = baina.getLocal("news"+this.displayCat.id);
		}
		return localData;
	},
	picStyleList : function(w,h){
		//用来返回图片style，从而控制图片的高宽等属性
		var outW = this.vW;//外层包裹div的尺寸
		var outH = (this.vH + 1 - 40 - 40)*0.4;//this.listHead.offsetHeight、this.listFooter.offsetHeight的高度是40
		var originalRatio = w/h;
		var returnW,returnH;
		if(outW/outH >= originalRatio){
			returnW = outW;
			returnH = parseInt(outW/originalRatio);
		}else{
			returnH = outH;
			returnW = parseInt(outH*originalRatio);
		}
		return "style='width:"+returnW+"px;height:"+returnH+"px'";
	},
	picDOM : function(news,index){
		//图片的DOM结构
		if(news){
			var titleClass = "picTitle" + this.titleSize(news.ttl, null, 34);
			if(news.pics[0].h){
				return "<a href='#detail"+news.id+"' class='picDiv' onclick='reader.detailClick("+news.id+","+index+");'><img src='"+news.pics[0].src+baina.netWorkType(true)+"' "+this.picStyleList(news.pics[0].w,news.pics[0].h)+" onload='baina.showCommonPic(this)' onerror='baina.errorPic(this)' /><div class='mask'></div><div class='"+titleClass+"'>"+news.ttl+"</div></a>";
			}else{
				return "<a href='#detail"+news.id+"' class='picDiv' onclick='reader.detailClick("+news.id+","+index+");'><img src='"+news.pics[0].src+baina.netWorkType(true)+"' onload='baina.adjustListPic(this);' onerror='baina.errorPic(this)' /><div class='mask'></div><div class='"+titleClass+"'>"+news.ttl+"</div></a>";
			}
		}else{
			return "";
		}
	},
	newsSrc : function(src){
		//处理新闻的来源
		return src ? src+" " : "";
	},
	picText1 : function(news,index){
		//图片模板，一行一条的DOM
		if(news){
			var visitedClass = news.visited ? ' visited' : '';
			var titleClass = "text1Title" + this.titleSize(news.ttl, 17, 34);
			return "<a href='#detail"+news.id+"' id='detail_" +news.id+ "' class='picText1"+visitedClass+"' onclick='reader.detailClick("+news.id+","+index+");'><div class='"+titleClass+"'>"+news.ttl+"</div><div class='text1Des'>"+this.newsSrc(news.src) + baina.manageDate(news.pub,true) +"</div></a>";
		}else{
			return "";
		}
	},
	picText2 : function(news0,news1,index){
		//图片模板，一行两条的DOM
		if(news1){
			var visited0Class = news0.visited ? ' visited' : '';
			var visited1Class = news1.visited ? ' visited' : '';
			var title0Class = "text2Title" + this.titleSize(news0.ttl, 8, 17);
			var title1Class = "text2Title" + this.titleSize(news1.ttl, 8, 17);
			return "<div class='picTextWrap'><div class='innerWrap'><a href='#detail" +news0.id+"' id='detail_" +news0.id+ "' class='picText2"+visited0Class+"' onclick='reader.detailClick("+news0.id+","+index+");'><div class='"+title0Class+"'>"+news0.ttl+"</div><div class='text2Des'>" + this.newsSrc(news0.src) + baina.manageDate(news0.pub,true) +"</div></a></div><div class='innerWrap'><a href='#detail"+news1.id+"' id='detail_" +news1.id+ "' class='picText2"+visited1Class+"' onclick='reader.detailClick("+news1.id+","+(index+1)+");'><div class='"+title1Class+"'>"+news1.ttl+"</div><div class='text2Des'>" + this.newsSrc(news1.src) + baina.manageDate(news1.pub,true) +"</div></a></div></div>";
		}else if(news0){
			return this.picText1(news0,index);
		}else{
			return "";
		}
	},
	titleSize : function(title, low, high){
		if (high && title.length > high){
			return " small";
		} else if (low && title.length < low){
			return " large";
		}
		return "";
	},
	colorDOM : function(news,index){
		//无图模板，有背景色的一行
		var color = news.id%4;//一共4种背景色
		if(news){
			var titleClass = "colorTitle" + this.titleSize(news.ttl, null, 26);
			return "<a href='#detail"+news.id+"' class='colorDiv color"+color+"' onclick='reader.detailClick("+news.id+","+index+");'><div class='" + titleClass + "'>" +news.ttl+"</div><div class='colorDes'>" + this.newsSrc(news.src) + baina.manageDate(news.pub,true) +"</div></a>";
		}else{
			return "";
		}
	},
	colorText1 : function(news,index){
		//无图模板，无背景色的一行
		if(news){
			var visitedClass = news.visited ? ' visited' : '';
			var titleClass = "color1Title" + this.titleSize(news.ttl, 17, 34);
			return "<a href='#detail"+news.id+"' id='detail_"+news.id+"' class='colorText1"+visitedClass+"' onclick='reader.detailClick("+news.id+","+index+");'><div class='"+titleClass+"'>"+news.ttl+"</div><div class='text1Des'>"+ this.newsSrc(news.src) + baina.manageDate(news.pub,true) +"</div></a>";
		}else{
			return "";
		}
	},
	colorText2 : function(news0,news1,index){
		//无图模板，一行两条的DOM
		if(news1){
			var visited0Class = news0.visited ? ' visited' : '';
			var visited1Class = news1.visited ? ' visited' : '';
			var title0Class = "color2Title" + this.titleSize(news0.ttl, 8, 17);
			var title1Class = "color2Title" + this.titleSize(news1.ttl, 8, 17);
			return "<div class='colorTextWrap'><div class='innerWrap'><a href='#detail"+news0.id+"' id='detail_"+news0.id+"' class='colorText2"+visited0Class+"' onclick='reader.detailClick("+news0.id+","+index+");'><div class='"+title0Class+"'>"+news0.ttl+"</div><div class='text2Des'>" + this.newsSrc(news0.src) + baina.manageDate(news0.pub,true) +"</div></a></div><div class='innerWrap'><a href='#detail"+news1.id+"' id='detail_"+news1.id+"' class='colorText2"+visited1Class+"' onclick='reader.detailClick("+news1.id+","+(index+1)+");'><div class='"+title1Class+"'>"+news1.ttl+"</div><div class='text2Des'>" + this.newsSrc(news1.src) + baina.manageDate(news1.pub,true) +"</div></a></div></div>";
		}else if(news0){
			return this.colorText1(news0,index);
		}else{
			return "";
		}
	},
	createNewsDOM : function(pList,pNum){
		//list页面，news的每一页的DOM
		var tDiv = document.createElement("div");
		tDiv.setAttribute("page",pNum);//把其所处的页数标上
		tDiv.className = "pageWrap";
		var num = 3;
		if((pList[0].pics && pList[0].pics.length && pList[0].pics[0].src) || (pList[2] && pList[2].pics && pList[2].pics.length && pList[2].pics[0].src)){
			//如果有图，使用图片的模板
			if(pList[0].pics && pList[0].pics.length && pList[2] && pList[2].pics && pList[2].pics.length){
				num = pList[0].id%3;
			}else if(pList[0].pics && pList[0].pics.length){
				num = 0;
			}else{
				num = 2;
			}
		}else{
			num = pList[0].id%3 + 3;
		}
		switch (num){
			//生成对应的DOM模板
			case 0:
				tDiv.innerHTML = [
					this.picDOM(pList[0],0),
					this.picText2(pList[1],pList[2],1),
					this.picText2(pList[3],pList[4],3),
					this.picText1(pList[5],5)
				].join("");
				break;
			case 1:
				tDiv.innerHTML = [
					this.picDOM(pList[0],0),
					this.picText2(pList[1],pList[2],1),
					this.picText1(pList[3],3),
					this.picText2(pList[4],pList[5],4)
				].join("");
				break;
			case 2:
				tDiv.innerHTML = [
					this.picText2(pList[0],pList[1],0),
					this.picDOM(pList[2],2),
					this.picText2(pList[3],pList[4],3),
					this.picText1(pList[5],5)
				].join("");
				break;
			case 3:
				tDiv.innerHTML = [
					this.colorDOM(pList[0],0),
					this.colorText2(pList[1],pList[2],1),
					this.colorText2(pList[3],pList[4],3),
					this.colorText1(pList[5],5)
				].join("");
				break;
			case 4:
				tDiv.innerHTML = [
					this.colorDOM(pList[0],0),
					this.colorText2(pList[1],pList[2],1),
					this.colorText1(pList[3],3),
					this.colorText2(pList[4],pList[5],4)
				].join("");
				break;
			case 5:
				tDiv.innerHTML = [
					this.colorText2(pList[0],pList[1],0),
					this.colorDOM(pList[2],2),
					this.colorText2(pList[3],pList[4],3),
					this.colorText1(pList[5],5)
				].join("");
				break;
		}
		return tDiv;
	},
	imgSpan : function(picObj){
		//根据图片数据对象，生成图片占位符span
		var result = "<span class='imgSpan' src='"+picObj.src+baina.netWorkType(true)+"'";
		if(picObj.h){
			result += " h='" + picObj.h + "' w='"+picObj.w+"'";
		}
		result += "></span>";
		return result;
	},
	createPicDOM : function(pList,pNum){
		//list页面，album的每一页的DOM
		var tDiv = document.createElement("div");
		tDiv.setAttribute("page",pNum);//把其所处的页数标上
		tDiv.className = "pageAWrap";
		var inString = "";
		if(this.vH/this.vW>=1.5){
			//5行模板
			inString += "<div class='album5R1'>";
			inString += "<div class='album5Wrap2L'>"+"<a href='#album"+pList[0].id+"' class='albumWrap2Up picWrapper' onclick='reader.detailClick("+pList[0].id+",0);'>"+this.imgSpan(pList[0].pics[0])+"</a>";
			if(pList[1]){
				inString += "<a href='#album"+pList[1].id+"' class='albumWrap2Down picWrapper' onclick='reader.detailClick("+pList[1].id+",1);'>"+this.imgSpan(pList[1].pics[0])+"</a>";
			}
			inString += "</div>";
			if(pList[2]){
				inString += "<a href='#album"+pList[2].id+"' class='albumWrapBigR picWrapper' onclick='reader.detailClick("+pList[2].id+",2);'>"+this.imgSpan(pList[2].pics[0])+"</a>";
			}
			inString += "</div>";
			if(pList[3]){
				inString += "<div class='album5R2'>"+"<a href='#album"+pList[3].id+"' class='albumWrap1Left picWrapper' onclick='reader.detailClick("+pList[3].id+",3);'>"+this.imgSpan(pList[3].pics[0])+"</a>";
				inString += "<div class='albumTitle color"+pList[0].id%4+"'>"+this.displayCat.name+"</div>";
				inString += "</div>";
			}
			if(pList[4]){
				inString += "<div class='album5R3'>";
				inString += "<a href='#album"+pList[4].id+"' class='albumWrapBigL picWrapper' onclick='reader.detailClick("+pList[4].id+",4);'>"+this.imgSpan(pList[4].pics[0])+"</a>";
				if(pList[5]){
					inString += "<div class='album5Wrap2R'>"+"<a href='#album"+pList[5].id+"' class='albumWrap2Up picWrapper' onclick='reader.detailClick("+pList[5].id+",5);'>"+this.imgSpan(pList[5].pics[0])+"</a>";
					if(pList[6]){
						inString += "<a href='#album"+pList[6].id+"' class='albumWrap2Down picWrapper' onclick='reader.detailClick("+pList[6].id+",6);'>"+this.imgSpan(pList[6].pics[0])+"</a>";
					}
					inString += "</div>";
				}
				inString += "</div>";
			}
		}else{
			//4行模板
			inString += "<div class='album4R1'>";
			inString += "<a href='#album"+pList[0].id+"' class='albumWrap1Left picWrapper' onclick='reader.detailClick("+pList[0].id+",0);'>"+this.imgSpan(pList[0].pics[0])+"</a>";
			if(pList[1]){
				inString += "<div class='album4Wrap2R'>"+"<a href='#album"+pList[1].id+"' class='album4Wrap2RL picWrapper' onclick='reader.detailClick("+pList[1].id+",1);'>"+this.imgSpan(pList[1].pics[0])+"</a>";
				if(pList[2]){
					inString += "<a href='#album"+pList[2].id+"' class='album4Wrap2RR picWrapper' onclick='reader.detailClick("+pList[2].id+",2);'>"+this.imgSpan(pList[2].pics[0])+"</a>";
				}
				inString += "</div>";
			}
			inString += "</div>";
			if(pList[3]){
				inString += "<div class='album4R2'>"+"<a href='#album"+pList[3].id+"' class='albumWrap1Left picWrapper' onclick='reader.detailClick("+pList[3].id+",3);'>"+this.imgSpan(pList[3].pics[0])+"</a>";
				inString += "<div class='albumTitle color"+pList[0].id%4+"'>"+this.displayCat.name+"</div>";
				inString += "</div>";
			}
			if(pList[4]){
				inString += "<div class='album4R3'>";
				inString += "<div class='album5Wrap2L'>"+"<a href='#album"+pList[4].id+"' class='albumWrap2Up picWrapper' onclick='reader.detailClick("+pList[4].id+",4);'>"+this.imgSpan(pList[4].pics[0])+"</a>";
				if(pList[5]){
					inString += "<a href='#album"+pList[5].id+"' class='albumWrap2Down picWrapper' onclick='reader.detailClick("+pList[5].id+",5);'>"+this.imgSpan(pList[5].pics[0])+"</a>";
				}
				inString += "</div>";
				if(pList[6]){
					inString += "<a href='#album"+pList[6].id+"' class='albumWrapBigR picWrapper' onclick='reader.detailClick("+pList[6].id+",6);'>"+this.imgSpan(pList[6].pics[0])+"</a>";
				}
				inString += "</div>";
			}
		}
		tDiv.innerHTML = inString;
		return tDiv;
	},
	clearListDiv : function(){
		//清除已经有了的三个div
		if(this.curDiv){
			baina.delNode(this.curDiv);
			this.curDiv = null;
		}
		if(this.prevDiv){
			baina.delNode(this.prevDiv);
			this.prevDiv = null;
		}
		if(this.nextDiv){
			baina.delNode(this.nextDiv);
			this.nextDiv = null;
		}
	},
	showCurPage : function(newsList){
		//显示当前页面的新闻或者图集
		var tempThis = this;
		if(newsList==undefined){
			var lList = baina.getLocal("news"+this.displayCat.id);
			if(lList){
				newsList = JSON.parse(lList).data;
			}else{
				newsList = [];
			}
		}
		var eachPage = 6;//每页显示的条数
		var createDOM;//创建每页的DOM结构
		if(this.displayCat.dt==1){
			//图集
			eachPage = this.picNum;
			createDOM = this.createPicDOM;
		}else{
			//其它情况，新闻
			eachPage = this.newsNum;
			createDOM = this.createNewsDOM;
		}
		this.totalPage = Math.ceil(newsList.length/eachPage); //总页数
		if(this.totalPage==0){
			return false;
		}
		if(this.curPage<=0){
			this.curPage = 0;
		}else if(this.curPage>=this.totalPage){
			this.curPage = this.totalPage-1;
		}
		//先查找listWrap中本身就存在的list
		if(this.displayCat.dt==1){
			var lPages = this.listWrap.getElementsByClassName("pageAWrap");
		}else{
			var lPages = this.listWrap.getElementsByClassName("pageWrap");
		}
		var hasPrev=false,hasCur=false,hasNext=false;
		var toBeDel = [];//需要删除的元素
		for(var i=0,l=lPages.length;i<l;i++){
			var tNum = lPages[i].getAttribute("page");
			if(tNum==this.curPage){
				hasCur = true;
				this.curDiv = lPages[i];
				baina.setTransform(this.curDiv,0,0);//设置为当前的页面
				this.curDiv.style["display"] = "block";
			}else if(tNum==this.curPage-1){
				hasPrev = true;
				this.prevDiv = lPages[i];
				baina.setTransform(this.prevDiv,-this.vW,0);//设置为上一页
				this.prevDiv.style["display"] = "block";
			}else if(tNum==this.curPage+1){
				hasNext = true;
				this.nextDiv = lPages[i];
				baina.setTransform(this.nextDiv,this.vW,0);//设置为下一页
				this.nextDiv.style["display"] = "block";
			}else{
				lPages[i].style["display"] = "none";//隐藏不在范围内的DOM
				toBeDel.push(lPages[i]);//把不显示的放到一个数组里面，稍后删除（如果不删除，越来越多，for循环越来越长，之后会白屏，手机处理不过来）
			}
		}
		if(!hasPrev){
			if(this.curPage>0){
				this.prevDiv = createDOM.call(this,newsList.slice((this.curPage-1)*eachPage,this.curPage*eachPage),this.curPage-1);
				baina.setTransform(this.prevDiv,-this.vW,0);//设置为上一页
				this.listWrap.appendChild(this.prevDiv);
			}else{
				//到第一页了，把preDiv清理掉
				this.prevDiv = null;
			}
		}
		if(!hasNext){
			if(this.curPage<this.totalPage-1){
				this.nextDiv = createDOM.call(this,newsList.slice((this.curPage+1)*eachPage,(this.curPage+2)*eachPage),this.curPage+1);
				baina.setTransform(this.nextDiv,this.vW,0);//设置为下一页
				this.listWrap.appendChild(this.nextDiv);
			}else{
				//最后一页了，把nextDiv清理掉
				this.nextDiv = null;
			}
		}
		if(!hasCur){
			this.curDiv = createDOM.call(this,newsList.slice(this.curPage*eachPage,(this.curPage+1)*eachPage),this.curPage);
			baina.setTransform(this.curDiv,0,0);//设置为当前的页面
			this.listWrap.appendChild(this.curDiv);
		}
		this.pageNum.innerHTML = (this.curPage+1) + " / " + this.totalPage;
		if(this.curPage+1>=this.totalPage && this.totalPage>1 && this.totalPage<this.maxPages){
			//自动请求下一页。必须在总页数大于1的时候才请求。否则left和right会同时请求，导致返回数据dataPosition错乱。另外，maxPages控制一下总的页数，否则localstorage可能会爆掉
			if(!this.requestRight){
				var lList = baina.getLocal("news" + this.displayCat.id);
				lList = JSON.parse(lList).data;
				this.dataPosition = "right";
				this.pageNum.className = "loading";
				var lastId = lList[lList.length-1].sort ? lList[lList.length-1].sort : lList[lList.length-1].id;
				this.requestRight = true;//结果返回前，不能再发起right的请求
				var url = baina.url + "sources/"+this.displayCat.id+"/docs" + "?mi=" + lastId + "&t=" + baina.refreshT() + baina.netWorkType();
				if(this.displayCat.dt==1){
					//图集
					url += "&rs=" + this.picNum*this.pages;		
				}else{
					//新闻
					url += "&rs=" + this.newsNum*this.pages;
				}
				baina.ajaxGet(encodeURI(url),function(text){tempThis.manageList(text);},function(text){tempThis.manageList(text);});
				//track
				baina.track("loadmore", "channel", this.displayCat.id, null, null, this.curPage);
			}
		}
		if(this.displayCat.dt==1){
			//图集，后处理图片
			//tempThis.showAblumPic();
			setTimeout(function(){tempThis.showAblumPic();},50);
		}
		for(var i=0,l=toBeDel.length;i<l;i++){
			//删掉不需要的，这样最多就三个div
			baina.delNode(toBeDel[i]);
		}
	},
	showCardsPage : function(newsList){
		//显示搞笑段子
		var tempThis = this;
		var target = this.picRows;

		var pic = tempThis.picOff ? "text" : "pic";
		if(pic == "text"){
			//无图
			target = this.textRows;
		}
		if(this.dataPosition == "left" || this.dataPosition == "new"){
			target.innerHTML = "";
			for(var i=0,l=newsList.length;i<l;i++){
				var rowDom = this.createListDom(newsList[i]);
				target.appendChild(rowDom);
			}
		}else{
			setTimeout(function(){
				//延迟消失loading
				if(newsList.length>0){
					tempThis.hideCardsLoading();
					
					for(var i=0,l=newsList.length;i<l;i++){
						var rowDom = tempThis.createListDom(newsList[i]);
						target.appendChild(rowDom);
					}
				}
			},1000);
		}
		//添加完成后即可继续请求
		this.isCardsRequest[pic] = false;
	},
	createListDom : function(item){
		var tDiv = document.createElement("div");
		tDiv.className = "row";
		tDiv.id = "row"+item.id;
		var avatar = "";
		var author = "";
		if(item.avatar && item.avatar.src && item.author){
			//是否有作者头像
			avatar = "<div class='rowHead'>"+
						"<div class='rowImgWrap'><img class='rowImg' src='"+item.avatar.src+"'/></div>"+
						"<div class='rowAuthor'>"+
							"<span class='authorName'>"+item.author+"</span>"+
							"<span class='rowTime'>"+baina.manageDate(item.pub,true)+"</span>"+
						"</div>"+
					 "</div>";
		}else{
			avatar = "<div class='null'></div>";
		}

		if(item.author){
			//显示作者
			author = item.author;
		}else if(item.src){
			//显示来源
			author = item.src;
		}

		tDiv.innerHTML = avatar+
						 "<div class='rowContent'>"+this.cardContentDom(item.cnt,item.pics)+"</div>"+
						 "<div class='rowFooter'>"+
						 	"<div class='zan' onclick='reader.toggleLike(this);'><span class='zanIcon'></span><span class='zanText'>"+item.up+"</span></div>"+
						 	"<div class='rowShare' onclick='reader.shareCardsToWeibo(this);' sourceUrl='"+item.url+"' author='"+author+"'><span class='rowShareIcon'></span><span class='rowShareText'>"+item.share+"</span></div>"+
						 "</div>";
		return tDiv;
	},
	cardContentDom : function(cnt,pics){
		var tContent = cnt;
		var reg = new RegExp("[(\n) ]*<dolphinimagestart--[(\S)]*--dolphinimageend>[(\n) ]*","gi");
		tContent.replace(reg,"\n");
		if(pics.length>0){
			for(var i=0,l=pics.length;i<l;i++){
				if(pics[i].src){
					//图片位于正文下面
					tContent += "<div class='cardImg'><img src='"+pics[i].src+baina.netWorkType(true)+"' onerror='baina.errorPic(this,\"dfdfdf\")' /></div>";
				}
			}
		}
		return  tContent.replace(/\n/g,'<br>');
	},
	loadingMore : function(){
		var tempThis = this;
		var picOff = tempThis.picOff ? "text" : "pic";
		this.showCardsLoading();

		//向下请求数据
		tempThis.dataPosition = "right";
		var lList = baina.getLocal("cards-"+picOff+tempThis.displayCat.id);
		if(lList){
			lList = JSON.parse(lList).data;
		}
		var pic = tempThis.picOff==true ? 0 : 1;
		var lastId = lList[lList.length-1].sort ? lList[lList.length-1].sort : lList[lList.length-1].id;
		var url = baina.url + "sources/"+tempThis.displayCat.id+"/contents" + "?mi=" + lastId + "&t=" + baina.refreshT() + baina.netWorkType() + "&rs="+tempThis.cardsNum +"&pic="+pic;

		baina.ajaxGet(encodeURI(url),function(text){tempThis.manageList(text);},function(text){tempThis.manageList(text);});
		tempThis.isCardsRequest[picOff] = true;

		//track
		baina.track("loadmore", "channel", this.displayCat.id, null, null, this.curPage);
	},
	showCardsLoading : function(){
		var targetLoading = this.picOff ? this.textLoading : this.picLoading;
		targetLoading.style["visibility"] = "visible";
	},
	hideCardsLoading : function(){
		var targetLoading = this.picOff ? this.textLoading : this.picLoading;
		targetLoading.style["visibility"] = "hidden";
	},
	picStyleAlbum : function(w,h,outerDiv){
		//用来返回图片style，从而控制图片的高宽等属性
		var outW = outerDiv ? outerDiv.offsetWidth : this.vW;//外层包裹div的尺寸
		var outH = outerDiv ? outerDiv.offsetHeight : this.vH;
		var originalRatio = w/h;
		var returnW,returnH;
		if(outW/outH >= originalRatio){
			returnW = outW;
			returnH = parseInt(outW/originalRatio);
		}else{
			returnH = outH;
			returnW = parseInt(outH*originalRatio);
		}
		return "style='width:"+returnW+"px;height:"+returnH+"px'";
	},
	showAblumPic : function(){
		//显示图集的图片，把span替换
		var wraps = this.listWrap.getElementsByClassName("pageAWrap");
		for(var i=0,l=wraps.length;i<l;i++){
			var wPage = wraps[i].getAttribute("page");
			if(wPage==this.curPage){
				//只处理当前页面的
				var pWrapper = wraps[i].getElementsByClassName("picWrapper");
				for(j=0,k=pWrapper.length;j<k;j++){
					if(pWrapper[j].innerHTML.indexOf("<span")!=-1){
						var tSpan = pWrapper[j].getElementsByTagName("span")[0];
						var tSrc = tSpan.getAttribute("src");
						var tH = tSpan.getAttribute("h");
						var tW = tSpan.getAttribute("w");
						var tString = "";
						if(tH){
							tString = "<div class='picWInner'><img src='"+tSrc+baina.netWorkType(true)+"' "+this.picStyleAlbum(tW,tH,tSpan)+" onload='baina.showCommonPic(this)' onerror='baina.errorPic(this)'/></div>";
						}else{
							tString = "<div class='picWInner'><img src='"+tSrc+baina.netWorkType(true)+"' onload='baina.adjustListPic(this);' onerror='baina.errorPic(this)'/></div>";
						}
						pWrapper[j].innerHTML = tString;
					}
				}
				break;
			}
		}
	},
	showLoading : function(){
		//显示loading的圈圈
		var tempThis = this;
		this.loadingTime = setTimeout(function(){
			tempThis.loading.style["display"] = "block";
			tempThis.initPos();
		},750);
	},
	hideLoading : function(){
		//隐藏loading的显示
		clearTimeout(this.loadingTime);
		this.loading.style["display"] = "none";
	},
	list_startX : 0,//开始的位置
	list_startY : 0,//开始的位置
	list_distanceX : 0,//水平方向移动的距离，用来判断是加载上一篇还是下一篇
	list_distanceY : 0,
	list_hasmove : false,
	list_dragDirec : "",
	list_changePage : false,//是否切换了页面
	_listTouchStart : function(e){
		if((e.touches && e.touches.length>1) || !this.curDiv){
			//这里只允许单指操作
			return false;
		}
		if(baina.viewData().scrollTop!=1){
			//触碰了list区域，如果浏览器的地址栏没有收起来，则让它收起来
			window.scrollTo(0,1);
		}
		this.list_startX = baina.touchX(e);
		this.list_startY = baina.touchY(e);
		this.list_distanceX = 0;
		this.list_distanceY = 0;
		this.list_dragDirec = "";
		this.list_hasmove = false;
		baina.setAnimation(this.curDiv,"");
	},
	_listTouchMove : function(e){
		e.preventDefault();
		if((e.touches && e.touches.length>1) || !this.curDiv){
			//这里只允许单指操作
			return false;
		}
		var currentX = baina.touchX(e);
		var currentY = baina.touchY(e);
		if(!this.list_dragDirec){
			//如果拖拽的方向没有被设定，则需要判断一下是往哪个方向拖拽
			var offsetX = currentX - this.list_startX;
			var offsetY = currentY - this.list_startY;
			var slope = offsetY / offsetX;
			if(Math.abs(offsetX)>40 && slope<0.66 && slope>-1){
				this.list_dragDirec = "x";
				this.list_hasmove = true;
			}else if(Math.abs(offsetY)>10 && (slope>0.66 || slope<-1)){
				this.list_dragDirec = "y";
				this.list_hasmove = true;
			}
		}
		if(this.list_dragDirec == "x"){
			//在移动的过程中就判断位置，进行切换
			if(!this.list_changePage){
				//如果没有切换页面，才进行判读
				this.list_distanceX = currentX - this.list_startX;
				var changePage = false;//是否切换了页面
				if(this.list_distanceX<-70){
					//往左边移动了，即手指往左边滑动了，且有一段距离
					if(this.curPage<this.totalPage-1){
						this.curPage++;
						changePage = true;
					}else{
						//往左边动一动，表明到边界了
						baina.setAnimation(this.curDiv,"leftAni 0.3s ease");
					}
				}else if(this.list_distanceX>70){
					//往右边移动了，即手指往右边移动了，且有一段距离
					if(this.curPage>0){
						this.curPage--;
						changePage = true;
					}else{
						//往右边动一动，表明到边界了
						baina.setAnimation(this.curDiv,"rightAni 0.3s ease");
					}
				}
				if(changePage){
					//如果切换的页面，动画
					this.list_changePage = true;
					this.showCurPage();//显示当前页面
				}
			}
		}else if(this.list_dragDirec == "y"){
			this.list_distanceY = currentY - this.list_startY;
		}
	},
	_listTouchEnd : function(e){
		if((e.touches && e.touches.length>0) ||!this.curDiv){
			//这里只允许单指操作。注意touchend的时候，如果是单指，已经没有手指了，就是0。这个跟start、move都不一样
			return false;
		}
		var tempThis = this;
		if(Math.abs(this.list_distanceX)>10 || Math.abs(this.list_distanceY)>10){
			e.preventDefault();
		}
		if(this.list_dragDirec == "x"){
			this.list_changePage = false;
		} else if (this.list_dragDirec == "y"){
			if(this.list_distanceY>80){
				//确定是否返回订阅页面
				var len = this.hArray.length;
				if(len>1 && this.hArray[len-2]=="sublist"){
					baina.track("slide", "backToSub", this.catid, "channel", this.displayCat.id, this.curPage);
					this.hArray.pop();
					this.hArray.pop();
					history.back();
					return;
				}
				//顶端往下一段距离，直接返回到首页
				this.channelBack();
				//track
				baina.track("slide", "backToScreen", this.iconCurPage, "channel", this.displayCat.id, this.curPage);
			}
		}
	},
	_listClick : function(e){
		//主要是IE10不能自动阻止点击行为
		if(this.list_hasmove){
			e.returnValue = false;
			e.preventDefault();
			return false;
		}
	},
	showArtPanel : function(){
		//显示detail的section
		var tempThis = this;
		this.detailNewsMode = true;
		this.channelMode = false;//因为隐藏channel是延时操作，所以这里要提前设置一下
		this.hideCPanel();
		this.detail.style["display"] = "block";
		this.wrapView.style["height"] = this.vH + 1 + "px";//为了支持overflow scroll的设备，不会滑到下面去
		setTimeout(function(){
			baina.setTransition(tempThis.detail,"-webkit-transform 0.5s ease");
			baina.setTransform(tempThis.detail,0,0);
		},5);
		setTimeout(function(){
			//延时一下，这样动画的过程中还能看到频道list页面的东西
			if(!tempThis.channelMode){
				//必须判断，否则用户操作很快的时候，这里延时触发就导致错误
				tempThis.hideChannel();
			}
		},750);
	},
	hideArtPanel : function(){
		//隐藏detail的section
		var tempThis = this;
		this.detailNewsMode = false;
		this.dNoList = false;//不在是直接进入的detail了
		this.hideSettingPanel();//设置面板隐藏
		baina.setTransition(this.detail,"-webkit-transform 0.5s ease");
		baina.setTransform(this.detail,0,(this.vH+1));
		this.prevArtDiv = null;
		this.nextArtDiv = null;
		this.curArtDiv = null;
		this.wrapView.style["height"] = "";
		setTimeout(function(){
			//延时一下，这样动画的过程中还能看到detail页面的东西
			tempThis.detailWrap.innerHTML = "";//把detail的块全部清掉
			tempThis.detail.style["display"] = "none";
		},750);
	},
	initArticle : function(){
		//初始化文章
		//分两种情况，一种是从list页面过来，这时候直接从localStorage里面拿。另一种情况是直接从链接里面搞参数，ajax请求数据展示
		this.showArtPanel();
		var tHash = baina.lhash();	
		var hasCatData = this.hasLocalCat();//是否有频道的数据	
		this.curNewsId = 0;
		if(tHash.match(/^detail\d+$/i)){
			//这里必须判断，要不有时候慢，hash还没切换过来
			this.curNewsId = tHash.slice(6);
		}
		//试图从本地缓存中拿数据。主要用于用户直接输入url，进入detail的情况
		if(hasCatData && this.displayCat!=undefined && this.displayCat.id!=undefined){
			//必须有当前id，只在当前id所在频道的本地数据中查找
			var lData = baina.getLocal("news"+this.displayCat.id);
			if(lData){
				lData = JSON.parse(lData).data;
				//从缓存里面找，看有没有这篇新闻
				this.curIndex = -1;
				for(var i=0,l=lData.length;i<l;i++){
					if(lData[i].id == this.curNewsId){
						this.curIndex = i;
						break;
					}
				}
				if(this.curIndex>=0){
					this.curArticle();//这里执行了就直接return了，所以后面的东西不需要区分同步、异步。
					return false;
					//这里有一种情况，就是手动输入的detail id，然后返回list。list中并没有这篇文章（因为太老）。这时候又history返回这篇正文，则需要再次请求（按道理也应该缓存起来）。这里有待修改。
				}
			}
		}
		
		if(tHash && tHash.match(/^detail\d+$/i)){
			//不在缓存中，则请求
			var tempThis = this;
			if(navigator.onLine){
				var tempId = tHash.slice(6);
				var url = baina.url + "docs/" + tempId + "?tp=1&t=" + baina.refreshT() + baina.netWorkType();
				baina.ajaxGet(encodeURI(url),function(text){tempThis.manageArticle(text);},function(text){tempThis.manageArticle(text);});
			}else{
				this.hideLoading();//隐藏loading
			}
		}else{
			this.showTip("新闻源读取地址错误，请重试");
			this.hideLoading();
			return false;
		}
	},
	manageArticle : function(text){
		var tempThis = this;
		if(typeof text=="string" && (text.slice(0,10).toLowerCase().match("<html") || text.slice(0,10).toLowerCase().match("<!doctype"))){
			this.showTip("Sorry,读取新闻源错误，请稍后重试");
			this.hideLoading();//隐藏loading
			return false;
		}else if(text){
			var tResponse;
			tResponse = eval("("+text+")");
			if(tResponse.sta != undefined && tResponse.sta==0){
				var tNews = {};
				for(var i in tResponse){
					if(i!="sta" && i!="rcd" && i!="ra"){
						//垃圾参数据不要了，rcd是精彩推荐，ra是相关新闻
						tNews[i] = tResponse[i];
					}
				}
				if(tNews.cnt!=undefined){
					this.contentLocal(tNews);//把取到的内容存到本地
					var contentDiv = baina.$("content"+tNews.id);
					if(contentDiv){
						//如果返回数据的DOM已经存在了的，则直接写入正文内容即可
						if(contentDiv.getElementsByClassName("cLoading").length>0){
							contentDiv.innerHTML = this.contentDOM(tNews);
						}
					}else{
						//DOM不存在，表明id不是list里面的，单独处理
						//这里需要把curIndex重新找一下
						if(tResponse.id==this.curNewsId){
							if(this.displayCat.id!=undefined){
								var lData = baina.getLocal("news"+this.displayCat.id);
								if(lData){
									lData = JSON.parse(lData).data;
									//从缓存里面找，看有没有这篇新闻
									this.curIndex = -1;
									for(var i=0,l=lData.length;i<l;i++){
										if(lData[i].id == this.curNewsId){
											this.curIndex = i;
											break;
										}
									}
								}
							}else if(tResponse.chid!=undefined){
								//这个地方的情况：用户加载过该频道，但当前在另外一个频道。这个时候点了一个分享链接，回到该频道，所以应该再检索一次
								this.displayCat.id = tResponse.chid;
								this.listOK = false;//list需要重新加载
								var lData = baina.getLocal("news"+this.displayCat.id);
								if(lData){
									lData = JSON.parse(lData).data;
									//从缓存里面找，看有没有这篇新闻
									this.curIndex = -1;
									for(var i=0,l=lData.length;i<l;i++){
										if(lData[i].id == this.curNewsId){
											this.curIndex = i;
											break;
										}
									}
								}
							}
							this.curArticle(tNews);
						}
					}
				}else{
					this.showTip("对不起，读取新闻源错误，请重试");
					this.hideLoading();
				}
			}else if(tResponse.sta != undefined && tResponse.sta==-7){
				this.showTip("频道已下线");
				this.hideLoading();
			}else if(tResponse.sta!=undefined){
				this.showTip("对不起，内部错误：" + tResponse.sta);
				this.hideLoading();
			}else{
				this.showTip("读取新闻源错误，请重试");
				this.hideLoading();
			}
		}
	},
	contentLocal : function(news){
		//把正文的内容存储到本地
		var tNews = {};
		//仅存储一部分list中没有的
		tNews.cnt = news.cnt;
		tNews.url = news.url;
		tNews.pic = news.pic;
		tNews.dt = news.dt;
		//下面这些，是在tp=1的时候才有的，也就是直接进入detail的时候有的
		if(news.ttl){
			tNews.ttl = news.ttl;
		}
		if(news.src){
			tNews.src = news.src;
		}
		if(news.pub){
			tNews.pub = news.pub;
		}
		if(news.pop){
			tNews.pop = news.pop;
		}
		baina.setLocal("d"+news.id,JSON.stringify(tNews));
		this.setDetailAll(news.id);//写入大的detail列表中
	},
	picStyleDetail : function(w,h){
		//返回图片尺寸
		var outerW = this.vW-30;
		var returnW,returnH;
		if(outerW < w){
			returnW = outerW;
			returnH = parseInt(outerW/w*h);
		}else{
			returnW = w;
			returnH = h;
		}
		return "style='width:"+returnW+"px;height:"+returnH+"px'";
	},
	contentDOM : function(news){
		//文章正文内容的DOM
		var detailNews = baina.getLocal("d"+news.id);
		if(detailNews){
			detailNews = JSON.parse(detailNews);
			var picList = detailNews.pic;
			var tContent = detailNews.cnt;
			if(picList.length>0){
				for(var i=0,l=picList.length;i<l;i++){
					var reg = new RegExp("[(\n) ]*<dolphinimagestart--"+picList[i].id+"--dolphinimageend>[(\n) ]*","gi");
					//此处忽略没有找到位置信息和id的图片
					//if(!reg.test(tContent) || picList[i].id==undefined){
						//如果图片没有id，或者在正文中没有找到位置信息
						//if(picList[i].h){
							//如果有图片的尺寸信息
							//if(Math.max(picList[i].h,picList[i].w)<20){
								//非常小的图片，放在同一行，并且放在最前面
								//tContent = "<img src='"+picList[i].src+baina.netWorkType(true)+"' "+this.picStyleDetail(picList[i].w,picList[i].h)+" />" + tContent;
							//}else{
								//尺寸大一些的图片
								//if(tContent.indexOf("\n\n")!=-1){
									//如果有换行，则把图片放到第一个换行的位置
									//tContent = tContent.replace(/\n\n/,"<div class='contentImgWrap'><img src='"+picList[i].src+baina.netWorkType(true)+"' "+this.picStyleDetail(picList[i].w,picList[i].h)+" onload='baina.showDetailPic(this)' /></div>");
								//}else{
									//否则放在最前面
									//tContent = "<div class='contentImgWrap'><img src='"+picList[i].src+baina.netWorkType(true)+"' "+this.picStyleDetail(picList[i].w,picList[i].h)+" onload='baina.showDetailPic(this)'/></div>" + tContent;
								//}
							//}
						//}else{
							//没有图片尺寸信息，统统放在新的一行上面
							//if(tContent.indexOf("\n\n")!=-1){
								//如果有换行，则把图片放到第一个换行的位置
								//tContent = tContent.replace(/\n\n/,"<div class='contentImgWrap'><img src='"+picList[i].src+baina.netWorkType(true)+"' onload='baina.adjustNewsPic(this);' /></div>");
							//}else{
								//否则放在最前面
								//tContent = "<div class='contentImgWrap'><img src='"+picList[i].src+baina.netWorkType(true)+"' onload='baina.adjustNewsPic(this);' /></div>" + tContent;
							//}
						//}
					//}else{
					if(picList[i].id!=undefined && reg.test(tContent)){
						//图片有位置信息在正文中
						if(picList[i].h){
							//有图片尺寸信息
							if(Math.max(picList[i].h,picList[i].w)<20){
								//非常小的图片，放在同一行
								tContent = tContent.replace(reg,"<img src='"+picList[i].src+baina.netWorkType(true)+"' "+this.picStyleDetail(picList[i].w,picList[i].h)+" />");
							}else{
								tContent = tContent.replace(reg,"<div class='contentImgWrap'><img src='"+picList[i].src+baina.netWorkType(true)+"' "+this.picStyleDetail(picList[i].w,picList[i].h)+" onload='baina.showDetailPic(this)' /></div>");
							}
						}else{
							//没有图片尺寸信息
							tContent = tContent.replace(reg,"<div class='contentImgWrap'><img src='"+picList[i].src+baina.netWorkType(true)+"' onload='baina.adjustNewsPic(this);' /></div>");
						}
					}
				}
			}
			tContent += "<a class='toOriginal' target='_blank' href='" + detailNews.url + "' onclick='reader.viewOriginal();'>查看原文</a>";
			return  tContent.replace(/\n/g,'<br>');
		}else{
			//没有内容的，显示loading的gif
			//专门调整loading位置的，主要是loading出现比较早，需要先调整
			this.vW = baina.viewData().viewWidth;
			this.vH = baina.viewData().viewHeight;
			if(!this.vW){this.vW = 320;}//某些android在启动的时候，预加载过快，会导致这个值取得0
			if(!this.vH){this.vH = 480;}
			return "<div class='cLoading' style='left:" + this.vW/2 + "px; top:" + this.vH/2 + "px; display: block;'>努力加载中...</div>";
		}
	},
	viewOriginal : function(){
		//track
		if(this.artList){
			var tid = this.artList[this.curIndex].id;
			baina.track("viewOriginal", "detailArt", tid, "channel", this.displayCat.id);
		}
	},
	newsSource : function(news){
		//detail页面最顶部的文章来源
		if(news.src){
			return news.src;
		}else{
			if(this.displayCat && this.displayCat.name){
				return this.displayCat.name;
			}else{
				return "海豚阅读";
			}
		}
	},
	detailDOM : function(news,index){
		//创建文章的DOM
		var tDiv = document.createElement("div");
		tDiv.id = "detail" + news.id;//把其所处的页数标上
		tDiv.className = "artWrap";
		if(index!=undefined){
			tDiv.setAttribute("index",index);
		}
		
		//文章的DOM结构
		var tNum = news.id%3;
		var color = news.id%4;
		if(tNum<2){
			//这种情况的比例稍大
			tDiv.innerHTML = [
				"<div class='artDrag' id='artDrag"+news.id+"'>",
				"<div class='artHead1 btop"+color+"'><div class='artSource1'>"+this.newsSource(news)+"</div><span>"+baina.manageDate(news.pub,true)+"</span></div>",
				"<div class='title1' id='artT"+news.id+"'>"+news.ttl+"</div>",//添加id，方便分享的时候提取
				"<div class='content' id='content"+news.id+"'>" + this.contentDOM(news) + "</div>",
				"</div>"
			].join("");
		}else{
			tDiv.innerHTML = [
				"<div class='artDrag' id='artDrag"+news.id+"'>",
				"<div class='artHead2'><div class='artSource2'>"+this.newsSource(news)+"</div><span>"+baina.manageDate(news.pub,true)+"</span></div>",
				"<div class='title2 color"+color+"'><div class='title2Inner' id='artT"+news.id+"'>"+news.ttl+"</div></div>",//添加id，方便分享的时候提取
				"<div class='content' id='content"+news.id+"'>" + this.contentDOM(news) + "</div>",
				"</div>"
			].join("");
		}
		return tDiv;
	},
	requestContent : function(newsid){
		//当新闻已经有标题信息，但没有正文信息的时候，请求正文
		var tempThis = this;
		if(navigator.onLine){
			var url = baina.url + "docs/" + newsid + "?tp=0&chid="+this.displayCat.id+"&t=" + baina.refreshT() + baina.netWorkType();
			baina.ajaxGet(encodeURI(url),function(text){tempThis.manageArticle(text);},function(text){tempThis.manageArticle(text);});
		}
	},
	curArticle : function(news){
		//显示当前的detail文章
		var tempThis = this;
		//先把list数据弄出来，如果当前新闻在list中，则按照list的顺序依次显示
		var tList = baina.getLocal("news"+this.displayCat.id);
		this.listLen = 0;
		var toBeDel = [];//要删除的DOM
		if(tList){
			var rawList = JSON.parse(tList);
			tList = JSON.parse(tList).data;
			this.artList = tList;
			this.listLen = tList.length;
		}
		if(this.curIndex>=0 && this.curIndex<=this.listLen-1){
			//curIndex大于0表明在新闻list中找到了对应的文章
			this.hideLoading();//隐藏loading

			//先查找detailWrap中本身就存在的art
			var lArts = this.detailWrap.getElementsByClassName("artWrap");
			var hasPrev=false,hasCur=false,hasNext=false;
			for(var i=0,l=lArts.length;i<l;i++){
				var tNum = lArts[i].getAttribute("index");//获取所处的位置
				if(tNum==this.curIndex){
					hasCur = true;
					this.curArtDiv = lArts[i];
					this.curArtDiv.style["display"] = "block";
					baina.setTransform(this.curArtDiv,0,0);//设置为当前的文章
				}else if(tNum==this.curIndex-1){
					hasPrev = true;
					this.prevArtDiv = lArts[i];
					this.prevArtDiv.style["display"] = "block";
					baina.setTransform(this.prevArtDiv,-this.vW,0);//设置为上一篇
					var tDragDiv = this.prevArtDiv.getElementsByClassName("artDrag")[0];//找到拖拽的对象，竖直方向归位
					baina.setTransition(tDragDiv,"");
					baina.setTransform(tDragDiv,0,0);
					tDragDiv.setAttribute("cy",0);//竖直方向移动归零
					this.prevArtDiv.scrollTop = 0;
				}else if(tNum==this.curIndex+1){
					hasNext = true;
					this.nextArtDiv = lArts[i];
					this.nextArtDiv.style["display"] = "block";
					baina.setTransform(this.nextArtDiv,this.vW,0);//设置为下一篇
					var tDragDiv = this.nextArtDiv.getElementsByClassName("artDrag")[0];//找到拖拽的对象，竖直方向归位
					baina.setTransition(tDragDiv,"");
					baina.setTransform(tDragDiv,0,0);
					tDragDiv.setAttribute("cy",0);//竖直方向移动归零
					this.nextArtDiv.scrollTop = 0;
				}else{
					lArts[i].style["display"] = "none";//隐藏不在范围内的DOM，节省资源
					toBeDel.push(lArts[i]);
				}
			}
			if(!hasPrev){
				if(this.curIndex>0){
					this.prevArtDiv = this.detailDOM(tList[this.curIndex-1],this.curIndex-1);
					baina.setTransform(this.prevArtDiv,-this.vW,0);//设置为上一页
					this.detailWrap.appendChild(this.prevArtDiv);
					if(!baina.getLocal("d"+tList[this.curIndex-1].id)){
						//如果没有正文内容，则请求
						this.requestContent(tList[this.curIndex-1].id);
					}
				}else{
					//到第一篇了，把prevArtDiv清理掉
					this.prevArtDiv = null;
				}
			}
			if(!hasNext){
				if(this.curIndex<this.listLen-1){
					this.nextArtDiv = this.detailDOM(tList[this.curIndex+1],this.curIndex+1);
					baina.setTransform(this.nextArtDiv,this.vW,0);//设置为下一页
					this.detailWrap.appendChild(this.nextArtDiv);
					if(!baina.getLocal("d"+tList[this.curIndex+1].id)){
						//如果没有正文内容，则请求
						//延时一下，这样更多的性能可以分给动画
						setTimeout(function(){tempThis.requestContent(tList[tempThis.curIndex+1].id);},60);
					}
				}else{
					//最后一篇了，把nextArtDiv清理掉
					this.nextArtDiv = null;
				}
			}
			if(!hasCur){
				this.curArtDiv = this.detailDOM(tList[this.curIndex],this.curIndex);
				baina.setTransform(this.curArtDiv,0,0);//设置为当前的页面
				this.detailWrap.appendChild(this.curArtDiv);
				if(!baina.getLocal("d"+tList[this.curIndex].id)){
					//如果没有正文内容，则请求
					//延时一下，这样更多的性能可以分给动画
					setTimeout(function(){tempThis.requestContent(tList[tempThis.curIndex].id);},60);
				}
			}
			for(var i=toBeDel.length-1;i>=0;i--){
				baina.delNode(toBeDel[i]);
			}
			//更新当前art对应的title的点击状态
			var curArt = document.getElementById("detail_" + tList[this.curIndex].id);
			baina.addClass(curArt, 'visited');
			rawList.data[this.curIndex].visited = true;
			baina.setLocal("news"+this.displayCat.id, JSON.stringify(rawList));

			//延迟更新当前art对应的newlist中的curPage
			setTimeout(function(){
				var curPage = Math.floor(tempThis.curIndex / tempThis.newsNum);
				if(tempThis.curPage != curPage){
					tempThis.curPage = curPage;
					tempThis.showCurPage();
				}
			},1000);
			//track
			this.artStartTiming = new Date();
			baina.track("pageView", "detailArt", tList[this.curIndex].id, "channel", this.displayCat.id);
		}else{
			//这篇文章的id不在list列表中，可能是手动输入的url，或者是以前的url。这里就需要使用传入的news参数
			this.dNoList = true;//表明是直接进入的detail
			if(news.chid!=undefined){
				//把当前频道切换到这篇文章所在的频道
				this.displayCat.id = news.chid;
				this.displayCat.name = news.chname;
				this.displayCat.dt = news.dt;
				//这里本来应该分两种情况，一种是本地缓存中本来就有该频道的list列表，一种是完全没有。这里为了从简，统一认为没有来处理，进行覆盖
				this.newsLocal(news.chid,[{src:news.src,pub:news.pub,pics:news.pic.slice(0,1),pop:news.pop,ttl:news.ttl,id:news.id}],Date.now()-2000,0);//自己创造该频道的该频道list的本地缓存，这个list只有一个新闻，就是该条新闻
				var lArts = this.detailWrap.getElementsByClassName("artWrap");
				for(var i=0,l=lArts.length;i<l;i++){
					lArts[i].style["display"] = "none";
					toBeDel.push(lArts[i]);
				}
				for(var i=toBeDel.length-1;i>=0;i--){
					baina.delNode(toBeDel[i]);//全部删掉
				}
				this.curIndex = 0;
				this.curArticle();//把这个只有一篇文章list的这篇文章，显示出来
				this.channelLocal();//把当前频道displayCat存一下
			}else{
				this.showTip("加载新闻出错，请重试");
			}
		}
	},
	d_cY : 0,
	d_lastcY : 0,
	d_lastY : 0,
	d_startX : 0,//开始的位置
	d_startY : 0,
	d_distanceX : 0,//水平方向移动的距离，用来判断是加载上一篇还是下一篇
	d_distanceY2 : 0,
	d_distanceY : 0,//y方向上，end之后缓冲的距离
	d_availbleH : 0,
	d_dragDirec : "",
	d_slowTimeY : 0,//缓冲所用的时间
	d_speedY : 0,//速度
	d_lastTime : 0,//时间戳
	d_dragV : null,//y方向上移动的对象
	d_borderStartY : false,//是否本身就在边界上，例如顶部或者底部
	d_borderStartY_top : false,//是否本身就在顶部边界上
	d_changePage : false,//是否切换了页面
	d_hasmove : false,
	_dTouchStart : function(e){
		if((e.touches && e.touches.length>1) || !this.curArtDiv){
			//这里只允许单指操作
			return false;
		}
		if(baina.viewData().scrollTop!=1){
			//触碰了list区域，如果浏览器的地址栏没有收起来，则让它收起来
			window.scrollTo(0,1);
		}
		if(this.d_dragDirec=="y"){
			//如果y方向上在缓冲，再touchstart的时候，需要停下来
			var style = document.defaultView.getComputedStyle(this.d_dragV, null);
			// Computed the transform in a matrix object given the style.
			var transform;
			if(window.MSCSSMatrix){
				transform = new MSCSSMatrix(style.transform);
			}else if(window.WebKitCSSMatrix){
				transform = new WebKitCSSMatrix(style.webkitTransform);
			}
			// Clear the active transition so it doesn’t apply to our next transform.
			baina.setTransition(this.d_dragV,"");
			// Set the element transform to where it is right now.
			this.d_cY = transform.m42;
			baina.setTransform(this.d_dragV,0,this.d_cY);
		}
		this.d_startX = baina.touchX(e);
		this.d_lastY = this.d_startY = baina.touchY(e);
		this.d_dragV = this.curArtDiv.getElementsByClassName("artDrag")[0];
		this.d_lastcY = this.d_cY = parseInt(this.d_dragV.getAttribute("cy")) || 0;//把记录的cy取出来
		this.d_distanceX = this.d_distanceY = this.d_distanceY2 = 0;
		this.d_hasmove = false;
		this.d_dragDirec = "";
		this.d_availbleH = this.d_dragV.offsetHeight - this.vH + this.detailFoot.offsetHeight;
		if(this.d_availbleH<0){
			this.d_availbleH = 0;
		}
		this.d_lastTime = e.timeStamp;
		this.slowTimeY = 0;
		if(this.d_cY>=0){
			this.d_borderStartY = true;
			this.d_borderStartY_top = true;
		}else if (Math.abs(this.d_cY)>=this.d_availbleH){
			this.d_borderStartY = true;
			this.d_borderStartY_top = false;
		}else{
			this.d_borderStartY = false;
			this.d_borderStartY_top = false;
		}
		baina.setAnimation(this.curArtDiv,"");
		
		//tracking
		this.prevIndex = this.curIndex;
	},
	_dTouchMove : function(e){
		e.preventDefault();
		if((e.touches && e.touches.length>1) || !this.curArtDiv){
			//这里只允许单指操作。没有curArtDiv的时候也不操作
			return false;
		}
		var tempThis = this;
		var currentX = baina.touchX(e);
		var currentY = baina.touchY(e);
		if(!this.d_dragDirec){
			//如果拖拽的方向没有被设定，则需要判断一下是往哪个方向拖拽
			var offsetX = currentX - this.d_startX;
			var offsetY = currentY - this.d_startY;
			var slope = offsetY / offsetX;
			//利用非对称的斜率适应右手拇指滑动的行为
			if(Math.abs(offsetX)>40 && slope<0.66 && slope>-1){
				this.d_dragDirec = "x";
				this.d_hasmove = true;
			}else if(Math.abs(offsetY)>10 && (slope>0.66 || slope<-1)){
				this.d_dragDirec = "y";
				this.d_hasmove = true;
			}
		}

		if(this.d_dragDirec == "x"){
			//在移动的过程中就判断位置，进行切换
			if(!this.d_changePage){
				this.d_distanceX = currentX - this.d_startX;
				var changePage = false;//是否切换了页面
				if(this.d_distanceX<-80){
					//往左边移动了，即手指往左边滑动了，且有一段距离
					if(this.curIndex<this.listLen-1){
						this.curIndex++;
						changePage = true;
					}else{
						//往左边动一动，表明到边界了
						baina.setAnimation(this.curArtDiv,"leftAni 0.3s ease");
					}
				}else if(this.d_distanceX>80){
					//往右边移动了，即手指往右边移动了，且有一段距离
					if(this.curIndex>0){
						this.curIndex--;
						changePage = true;
					}else{
						//往右边动一动，表明到边界了
						baina.setAnimation(this.curArtDiv,"rightAni 0.3s ease");
					}
				}
				if(changePage){
					//track阅读的情况
					this.trackNewsReading();
					//如果切换的页面，动画
					this.d_changePage = true;
					this.curArticle();//显示当前新闻
					//track滑动的行为
					if(this.artList){
						var slideDir = this.d_distanceX < 0 ? "left" : "right";
						var curId = this.artList[this.curIndex].id;
						var prevId = this.artList[this.prevIndex].id;
						baina.track("slide", "detailArt", curId, "detailArt", prevId, slideDir);
					}
				}
			}
		}else if(this.d_dragDirec == "y"){
			this.d_cY = this.d_lastcY + currentY - this.d_lastY;
			if(this.d_cY>0 || Math.abs(this.d_cY)>this.d_availbleH){
				//到边界，还拖拽的时候，速度减半
				//this.d_cY = this.d_lastcY + (currentY- this.d_lastY)/2;
				//到边界，还拖拽的时候，不滑动
				this.d_cY = this.d_lastcY;
			}
			this.d_speedY = 1.3 * (currentY - this.d_lastY)/(e.timeStamp - this.d_lastTime);
			if (Math.abs(this.d_speedY) > 3){
				this.d_speedY = 3 * this.d_speedY / Math.abs(this.d_speedY);
			}
			this.acceleration = this.d_speedY > 0 ? -0.004 : 0.004;//加速度常量，可根据喜好适当调整。减速运动，所以方向跟速度是相反的。
			this.d_slowTimeY = -parseInt(this.d_speedY/this.acceleration);
			this.d_distanceY = -parseInt(0.5*this.acceleration*Math.pow(this.d_slowTimeY,2));//根据速度，计算此时松手滑行的距离。
			this.d_lastcY = this.d_cY;
			this.d_lastY = currentY;
			this.d_distanceY2 = currentY - this.d_startY;
			this.d_lastTime = e.timeStamp;
			baina.setTransform(this.d_dragV,0,this.d_cY);
		}
	},
	_dTouchEnd : function(e){
		if((e.touches && e.touches.length>0) || !this.curArtDiv){
			//这里只允许单指操作。注意touchend的时候，如果是单指，已经没有手指了，就是0。这个跟start、move都不一样
			return false;
		}
		var tempThis = this;
		if(Math.abs(this.d_distanceX)>10 || Math.abs(this.d_distanceY2)>10){
			e.preventDefault();
		}
		if(this.d_dragDirec == "x"){
			if(!this.d_changePage){
				if(this.d_distanceX<-80){
					//往左边移动了，即手指往左边滑动了，且有一段距离
					if(this.curIndex>=this.listLen-1 && this.totalPage<this.maxPages){
						//this.showTip("加载新闻中...");
						//这里相当于在detail请求list的数据
						if(!this.requestRight){
							var lList = baina.getLocal("news" + this.displayCat.id);
							lList = JSON.parse(lList).data;
							this.dataPosition = "right";
							var lastId = lList[lList.length-1].sort ? lList[lList.length-1].sort : lList[lList.length-1].id;
							this.requestRight = true;//结果返回前，不能再发起right的请求
							var url = baina.url + "sources/"+this.displayCat.id+"/docs" + "?mi=" + lastId + "&t=" + baina.refreshT() + baina.netWorkType();
							if(this.displayCat.dt==1){
								//图集
								url += "&rs=" + this.picNum*this.pages;		
							}else{
								//新闻
								url += "&rs=" + this.newsNum*this.pages;
							}
							baina.ajaxGet(encodeURI(url),function(text){
								tempThis.manageList(text,undefined,true);
								tempThis.curArticle();//list的数据返回以后，重新组织一下，以便生成nextArtDiv
								tempThis.showCurPage();//重新计算出list页面的相关数据，这样返回list的时候不会出错
							},function(text){tempThis.manageList(text);});
						}
					}
				}else if(this.d_distanceX>80){
					//往右边移动了，即手指往右边移动了，且有一段距离
					if(this.curIndex<=0){
						if(this.dNoList){
							//直接进入的detail，需要请求左边的文章
							if(!this.requestLeft){
								var lList = baina.getLocal("news" + this.displayCat.id);
								lList = JSON.parse(lList).data;
								this.dataPosition = "left";
								var firstId = lList[0].sort ? lList[0].sort : lList[0].id;
								this.requestLeft = true;//结果返回前，不能再发起left的请求
								var url = baina.url + "sources/"+this.displayCat.id+"/docs" + "?si=" + firstId + "&t=" + baina.refreshT() + baina.netWorkType();
								if(this.displayCat.dt==1){
									//图集
									url += "&rs=" + (this.picNum*this.pages-1);//少请求一篇
								}else{
									//新闻
									url += "&rs=" + (this.newsNum*this.pages-1);
								}
								baina.ajaxGet(encodeURI(url),function(text){
									tempThis.manageList(text,undefined,true);
									tempThis.curArticle();//list的数据返回以后，重新组织一下，以便生成prevArtDiv
								},function(text){tempThis.manageList(text);});
							}
						}
					}
				}
			}
			this.d_changePage = false;
		}else if(this.d_dragDirec == "y"){
			if(this.d_borderStartY_top && this.d_distanceY2 > 80){
				//track阅读的情况
				this.trackNewsReading();
				//顶端往下一段距离，直接返回到list
				this.detailBack();
				//track滑动的行为
				if(this.artList){
					var tid = this.artList[this.curIndex].id;
					baina.track("slide", "backToChannel", this.displayCat.id, "detailArt", tid);
				}
				return false;
			}
			//计算目标位置
			this.d_cY = this.d_lastcY + this.d_distanceY;
			//出界的情况
			if(this.d_cY>0){
				//因为路程短了，根据速度重新计算时间
				this.d_distanceY -= this.d_cY;
				this.d_slowTimeY = 2 * this.d_distanceY / this.d_speedY;
				this.d_cY = 0;
			}else if(Math.abs(this.d_cY)>this.d_availbleH){
				this.d_distanceY = this.d_distanceY - this.d_cY - this.d_availbleH;
				this.d_slowTimeY = 2 * this.d_distanceY / this.d_speedY;
				this.d_cY = -this.d_availbleH;
			}
			this.autoMoveTo(this.d_dragV,0,this.d_cY,this.d_slowTimeY);
			this.d_dragV.setAttribute("cy",this.d_cY);//把各自的cY记录下来，否则因为左右切换，cy会乱，只能各自记录各自的
		}
	},
	_dSelect : function(e){
		//主要是ie10不能正确阻止select，这里导致无故频繁出现文本选择框
		if(this.d_hasmove){
			e.returnValue = false;
			e.preventDefault();
			return false;
		}
	},
	d_startTop : 0,//起始的顶端位置
	_dScrollStart : function(e){
		//给支持overflow:scroll的设备使用的
		var tempThis = this;
		if((e.touches && e.touches.length>1) || !this.curArtDiv){
			//这里只允许单指操作。没有this.curArtDiv的时候也不操作
			return false;
		}
		if(baina.viewData().scrollTop!=1){
			//触碰了list区域，如果浏览器的地址栏没有收起来，则让它收起来
			window.scrollTo(0,1);
		}
		this.d_startX = baina.touchX(e);
		this.d_startY = baina.touchY(e);
		this.d_startTop = this.curArtDiv.scrollTop;//记录一下滑动起始的位置，下拉返回的时候需要判断
		this.d_distanceX = this.d_distanceY = 0;
		this.d_dragDirec = "";
		baina.setAnimation(this.curArtDiv,"");
		//tracking
		this.prevIndex = this.curIndex;
	},
	_dScrollMove : function(e){
		if((e.touches && e.touches.length>1) || !this.curArtDiv){
			//这里只允许单指操作。没有this.curArtDiv的时候也不操作，否则this.curArtDiv.scrollTop会判断出错
			return false;
		}
		var tempThis = this;
		var currentX = baina.touchX(e);
		var currentY = baina.touchY(e);
		var curDiv = this.curArtDiv;
		this.d_distanceY = currentY - this.d_startY;
		if((this.d_distanceY>0 && curDiv.scrollTop<=1 && !this.d_dragDirec)
			||(this.d_distanceY<0 && curDiv.scrollTop+curDiv.clientHeight>=curDiv.scrollHeight)){
			//在底端的时候，往上拉，为了避免额外的边界bounce，需要禁用系统默认
			//在顶端的时候，往下拉，并且还没有定方向，这个时候是返回操作，需要禁用系统默认
			e.preventDefault();
		}
		if(!this.d_dragDirec){
			//如果拖拽的方向没有被设定，则需要判断一下是往哪个方向拖拽
			if(Math.abs(currentX - this.d_startX)>40){
				this.d_dragDirec = "x";
			}else if(Math.abs(currentY - this.d_startY)>10){
				this.d_dragDirec = "y";
			}
		}
		if(this.d_dragDirec == "x"){
			e.preventDefault();
			//在移动的过程中就判断位置，进行切换
			if(!this.d_changePage){
				this.d_distanceX = currentX - this.d_startX;
				var changePage = false;//是否切换了页面
				if(this.d_distanceX<-80){
					//往左边移动了，即手指往左边滑动了，且有一段距离
					if(this.curIndex<this.listLen-1){
						this.curIndex++;
						changePage = true;
					}else{
						//往左边动一动，表明到边界了
						baina.setAnimation(this.curArtDiv,"leftAni 0.3s ease");
					}
				}else if(this.d_distanceX>80){
					//往右边移动了，即手指往右边移动了，且有一段距离
					if(this.curIndex>0){
						this.curIndex--;
						changePage = true;
					}else{
						//往右边动一动，表明到边界了
						baina.setAnimation(this.curArtDiv,"rightAni 0.3s ease");
					}
				}
				if(changePage){
					//track阅读的情况
					this.trackNewsReading();
					//如果切换的页面，动画
					this.d_changePage = true;
					this.curArticle();//显示当前新闻
					//track滑动的行为
					if(this.artList){
						var slideDir = this.d_distanceX < 0 ? "left" : "right";
						var curId = this.artList[this.curIndex].id;
						var prevId = this.artList[this.prevIndex].id;
						baina.track("slide", "detailArt", curId, "detailArt", prevId, slideDir);
					}
				}
			}
		}
	},
	_dScrollEnd : function(e){
		//e.preventDefault();
		if(baina.viewData().scrollTop!=1){
			//如果浏览器的地址栏没有收起来，则让它收起来
			window.scrollTo(0,1);
		}
		if((e.touches && e.touches.length>0) || !this.curArtDiv){
			//这里只允许单指操作。注意touchend的时候，如果是单指，已经没有手指了，就是0。这个跟start、move都不一样
			return false;
		}
		var tempThis = this;
		if(this.d_dragDirec == "x"){
			if(!this.d_changePage){
				if(this.d_distanceX<-80){
					//往左边移动了，即手指往左边滑动了，且有一段距离
					if(this.curIndex>=this.listLen-1 && this.totalPage<this.maxPages){
						//这里相当于在detail请求list的数据
						if(!this.requestRight){
							var lList = baina.getLocal("news" + this.displayCat.id);
							lList = JSON.parse(lList).data;
							this.dataPosition = "right";
							var lastId = lList[lList.length-1].sort ? lList[lList.length-1].sort : lList[lList.length-1].id;
							this.requestRight = true;//结果返回前，不能再发起right的请求
							var url = baina.url + "sources/"+this.displayCat.id+"/docs" + "?mi=" + lastId + "&t=" + baina.refreshT() + baina.netWorkType();
							if(this.displayCat.dt==1){
								//图集
								url += "&rs=" + this.picNum*this.pages;		
							}else{
								//新闻
								url += "&rs=" + this.newsNum*this.pages;
							}
							baina.ajaxGet(encodeURI(url),function(text){
								tempThis.manageList(text,undefined,true);
								tempThis.curArticle();//list的数据返回以后，重新组织一下，以便生成nextDiv
								tempThis.showCurPage();//重新计算出list页面的相关数据，这样返回list的时候不会出错
							},function(text){tempThis.manageList(text);});
						}
					}
				}else if(this.d_distanceX>80){
					//往右边移动了，即手指往右边移动了，且有一段距离
					if(this.curIndex<=0){
						if(this.dNoList){
							//直接进入的detail，需要请求左边的文章
							if(!this.requestLeft){
								var lList = baina.getLocal("news" + this.displayCat.id);
								lList = JSON.parse(lList).data;
								this.dataPosition = "left";
								var firstId = lList[0].sort ? lList[0].sort : lList[0].id;
								this.requestLeft = true;//结果返回前，不能再发起left的请求
								var url = baina.url + "sources/"+this.displayCat.id+"/docs" + "?si=" + firstId + "&t=" + baina.refreshT() + baina.netWorkType();
								if(this.displayCat.dt==1){
									//图集
									url += "&rs=" + (this.picNum*this.pages-1);//少请求一篇
								}else{
									//新闻
									url += "&rs=" + (this.newsNum*this.pages-1);
								}
								baina.ajaxGet(encodeURI(url),function(text){
									tempThis.manageList(text,undefined,true);
									tempThis.curArticle();//list的数据返回以后，重新组织一下，以便生成prevArtDiv
								},function(text){tempThis.manageList(text);});
							}
						}
					}
				}
			}
			this.d_changePage = false;
		} else if (this.d_dragDirec == "y"){
			if(this.d_distanceY>80 && this.d_startTop<=0){
				//track阅读的情况
				this.trackNewsReading();
				//只有在顶部为0的时候，下拉超过80才返回
				this.detailBack();
				//track滑动的行为
				if(this.artList){
					var tid = this.artList[this.curIndex].id;
					baina.track("slide", "backToChannel", this.displayCat.id, "detailArt", tid);
				}
				return false;
			}
		}
	},
	autoMoveTo : function(target,posX,posY,time,timingfunc){
		if(timingfunc != undefined){
			baina.setTransition(target,"-webkit-transform " + time/1000 + "s " + timingfunc);
		}else{
			baina.setTransition(target,"-webkit-transform " + time/1000 + "s cubic-bezier(0.33, 0.66, 0.66, 1)");
		}
		baina.setTransform(target,posX,posY);
	},
	detailBack : function(e){
		//返回到list界面
		if(e){
			e.preventDefault();
			e.stopPropagation();
		}
		var len = this.hArray.length;
		if(len>1){
			if(this.hArray[len-2]=="channel"){
				this.hArray.pop();
				this.hArray.pop();
				history.back();
				return false;
			}
		}else if(e){
			//从返回按钮而来，直接历史返回
			if(history.length > 1){
				history.back();
				return false;
			}else if(window.dolphin && window.dolphin.backToPreNormalPage){
				var url = window.location.href;
				window.dolphin.backToPreNormalPage(url);
				return false;
			}
		}
		location.hash = "ch" + this.displayCat.id;
	},
	channelBack : function(e){
		//返回到首页
		var tHash = baina.lhash();
		if(tHash.match(/^((detail\d+)|(album\d+))$/i)){
			//在detail的状态是不可能返回home的。这里这样判断是避免操作过快导致的一个bug：在list界面，点击一条新闻，然后还没等detail弹出来，快速下拉页面，让其返回home。也就是同时触发去detail和回home。这里控制的逻辑是，点击了detail就去detail好了，通过这里的判读屏蔽掉回home。
			return false;
		}
		var len = this.hArray.length;
		if(len>1){
			if(this.hArray[len-2]=="chlist"){
				this.hArray.pop();
				this.hArray.pop();
				history.back();
				return false;
			}else if(this.hArray[len-2]=="sublist"){
				//确定是否返回订阅页面
				baina.track("click", "backToSub", this.catid, "channel", this.displayCat.id, this.curPage);
				this.hArray.pop();
				this.hArray.pop();
				history.back();
				return false;
			}else if(len>2){
				if(this.subDListMode && this.hArray[len-3]=="chlist"){
					//如果是订阅的二级list页面的确认按钮
					this.hArray.pop();
					this.hArray.pop();
					this.hArray.pop();
					history.go(-2);
					return false;
				}
			}
		}
		//当直接在地址栏输入url
		if(e){
			if(len>1){
				history.back();
				return false;
			}else if(window.dolphin && window.dolphin.backToPreNormalPage){
				var url = window.location.href;
				window.dolphin.backToPreNormalPage(url);
				return false;
			}
		}
		location.hash = "";
	},
	showCPanel : function(){
		//显示channel订阅的section
		this.channelListMode = true;
		this.cList.style["display"] = "block";
		if(document.toggleLongClickEnabled){
			//海豚浏览器某些版本特有方法，禁止长按弹出复制图片以及文字的菜单
			document.toggleLongClickEnabled(false);
		}
	},
	hideCPanel : function(){
		//隐藏首页的section
		var tempThis = this;
		this.channelListMode = false;
		this.hideWelPanel();
		setTimeout(function(){
			//延时一下，这样动画的过程中还能看到channel页面的东西
			if(!tempThis.channelListMode){
				tempThis.cList.style["display"] = "none";//把channel订阅的块隐藏
			}
		},750);
		if(document.toggleLongClickEnabled){
			//海豚浏览器某些版本特有方法，恢复长按弹出复制图片以及文字的菜单
			document.toggleLongClickEnabled(true);
		}
	},
	showWelPanel : function(){
		//显示欢迎的封面
		if (this.hasWelPanel){
			var tempThis = this;
			this.welPanelMode = true;
			this.welPanel.style["display"] = "block";
			setTimeout(function(){
				baina.setTransform(tempThis.welPanel,0,0);
			},5);
		}
	},
	hideWelPanel : function(){
		//隐藏欢迎的封面
		if (this.hasWelPanel){
			var tempThis = this;
			this.welPanelMode = false;
			baina.setTransform(this.welPanel,0,-(this.vH+2));
			setTimeout(function(){
				//延时一下，这样动画的过程中还能看到channel页面的东西
				if(!tempThis.welPanelMode){
					tempThis.welPanel.style["display"] = "none";//把channel订阅的块隐藏
				}
			},300);
		}
	},
	getLocalData : function(){
		//获取本地的数据，存到当前页面的变量中
		var lChannel = baina.getLocal("channels");//取出本地缓存中的频道列表
		if(lChannel){
			lChannel = JSON.parse(lChannel);
			this.Categories = lChannel.Categories;
			if(lChannel.iconCurPage){
				this.iconCurPage = parseInt(lChannel.iconCurPage);
			}
		}
	},
	hasLocalCat : function(){
		//本地是否有Categories的数据
		var lChannel = baina.getLocal("channels");//取出本地缓存中的频道列表
		var hasLData = false;//是否有本地数据
		this.getLocalData();//获取本地的数据
		if(this.Categories && this.Categories.length){
			//有时候本地的数据出错，导致channelLocal正确执行，但是值是空的
			hasLData = true;
		}else{
			this.Categories = [];//归位，否则可能变成undefined
			this.clearNewsLocal();//如果出现数据错误的情况，把缓存中的channel/news数据都清除掉
		}
		return hasLData;
	},
	listChannel : function(){
		//初始化频道列表
		var tempThis = this;
		this.showCPanel();	
		this.iconPosition2();//计算icon的位置相关参数
		var hasLData = this.hasLocalCat();
		//这里注释掉是因为在历史后退时，当前频道被清空了
		//this.displayCat = {};//回到首页，没有当前频道了
		if(!hasLData){
			var url = baina.url + "sub/init" + "?t=" + baina.refreshT() + baina.netWorkType();
			this.showLoading();
			baina.ajaxGet(encodeURI(url),function(text){tempThis.manageCList(text);},function(text){tempThis.manageCList(text);});
		}else{
			//有本地数据，显示频道的列表
			if(this.channelWrap.innerHTML.length<10){
				//只有列表没有创建的时候，才创建
				this.createCList();
			}

			//进入app时，会进行一次channel缓存数据的更新
			if(!this.isUpdateChannel){
				var url = baina.url + "sub/init" + "?t=" + baina.refreshT() + baina.netWorkType();
				baina.ajaxGet(encodeURI(url),function(text){tempThis.updateLocalChannel(text);},function(text){tempThis.updateLocalChannel(text);});
			}
		}
		baina.track("pageView", "screen", 1);
	},
	updateLocalChannel : function(text){
		var tempThis = this;
		var newAddedChannels = [];
		if(text){
			var oldChannel = JSON.parse(baina.getLocal("channels"));
			oldChannelCat = oldChannel.Categories;
			oldChannelDisplay = oldChannel.displayCat;
			var newChannel = JSON.parse(text);
			newChannel = newChannel.defsrc;
			for(var i=0,l=newChannel.length; i<l; i++){
				if(oldChannelDisplay.id == newChannel[i].chid){
					oldChannelDisplay.dt = newChannel[i].dt;
					oldChannelDisplay.chtype = newChannel[i].chtype;
				}
				for(var j=0,le=oldChannelCat.length; j<le; j++){
					if(newChannel[i].chid == oldChannelCat[j].id){
						oldChannelCat[j].dt = newChannel[i].dt;
						oldChannelCat[j].chtype = newChannel[i].chtype;
						break;
					}
				}
				if(j==le){
					//没有匹配到本地channel，作为新的channel
					newAddedChannels.push(newChannel[i]);
				}
			}
			newAddedChannels = newAddedChannels.filter(function(item){
				return tempThis.delChannels.indexOf(item.chid) != -1;
			});
			var oldLen = oldChannelCat.length;
			for(var z=0,len=newAddedChannels.length; z<len; z++){
				oldChannelCat[oldLen+z] = {id:newAddedChannels[z].chid,name:newAddedChannels[z].chname,cov:newAddedChannels[z].cov,dt:newAddedChannels[z].dt,chtype:newAddedChannels[z].chtype,movable:newAddedChannels[z].movable};
			}
			oldChannel.Categories = oldChannelCat;
			oldChannel.displayCat = oldChannelDisplay;
			this.Categories = oldChannelCat;
			this.displayCat = oldChannelDisplay;
			baina.setLocal("channels",JSON.stringify(oldChannel));
			this.isGetUpdates = true;//可以去获取首页频道的更新数目
			this.createCList();
			this.isUpdateChannel = true;//已经更新过channel的缓存了
		}
	},
	createCList : function(){
		//根据频道信息，创建频道列表
		var tempThis = this;
		var len = this.Categories.length;//先把长度取出来
		if(!len){
			return false;
		}
		var tChannel = JSON.parse(baina.getLocal("channels"));
		if(tChannel.iPageLen){
			//大体思路就是如果本地缓存里面有（上次访问过），那么首次创建的时候，完全按照上回的来
			//如果这次打开的时候屏幕尺寸跟上次不一样，没关系，adjustIconPos()函数会解决
			this.iPageLen = parseInt(tChannel.iPageLen);
		}else{
			this.iPageLen = Math.ceil(len/this.eachPageNum);
		}
		if(tChannel.iconCurPage){
			//是否有目前位于第几页。icons可能有很多页
			this.iconCurPage = parseInt(tChannel.iconCurPage);
		}else{
			//初始化到第0页
			this.iconCurPage = 0;
			tChannel.iconCurPage = 0;
		}
		this.cPage.innerHTML = baina.strIconPage(this.iconCurPage + 1);
		var tFrag = document.createDocumentFragment();
		for(var i=0;i<this.iPageLen;i++){
			//创建icons所被包裹的页面
			var tDiv = document.createElement("div");
			tDiv.className = "iconPage";
			tDiv.setAttribute("page",i);
			tDiv.style["width"] = this.iconPageWidth+"px";
			this.iPages[i] = tDiv;
			baina.setTransform(this.iPages[i],(this.iconPageWidth*(i-this.iconCurPage)),0);
			tFrag.appendChild(this.iPages[i]);
			this.icons[i] = [];//创建icons数组项
		}
		//tempPage目前已经计算到第几页的icon了；j是当前这一页的第几个icon，用来确定位移
		var tempPage=0,j=0;
		var postAry = [];
		//从本地缓存中获取update数据
		var updates = baina.getLocal("updates");
		var now = new Date();
		var updateTime = now.setHours(now.getHours()-24);
		if(updates){
			//获取上次一的更新时间
			var updatesData = JSON.parse(updates);
			updateTime = updatesData.lastUpdateTime;
		}

		for(var i=0;i<len;i++){
			//兼容并修正老数据中推荐的部分
			if(!this.Categories[i].chtype && this.Categories[i].id==2407){
				this.Categories[i].chtype = "r";
			}
			//把各个icon放到各自页面应有的位置
			var tDiv = document.createElement("div");
			var innerHTML = "";
			tDiv.setAttribute("cid",this.Categories[i].id);
			tDiv.setAttribute("dt",this.Categories[i].dt);
			tDiv.setAttribute("chtype",this.Categories[i].chtype || "n"); //默认为"n"普通, "r"为推荐
			tDiv.setAttribute("movable",this.Categories[i].movable || "true"); //默认为"true"可移动
			if(this.Categories[i].chtype=="r"){
				//推荐频道是不可删除的
				innerHTML += "<span class='recommend'></span>";
			}
			if(this.Categories[i].dt==1){
				tDiv.className = "special";
			}else{
				tDiv.className = "normal";
			}
			if(this.Categories[i].cov && this.Categories[i].cov.src){
				innerHTML += "<img class='iconImg' src='" + encodeURI(this.Categories[i].cov.src) + "'>";
			}
			innerHTML += "<span class='iconTitle'>" + baina.subs(this.Categories[i].name,10,true) + "</span>";
			tDiv.innerHTML = innerHTML; //截取一下，最多5个汉字。
			var tCurPage = this.Categories[i].iconPos;
			if(tCurPage!=undefined){
				//如果已经有该图标位于第几页的第几个
				tempPage = tCurPage.pNum;
				j = tCurPage.count;
			}else{
				if(j>=this.eachPageNum){
					//j超出每页的个数了，转到下一页
					j=0;
					tempPage++;
				}
				this.Categories[i].iconPos = {pNum:tempPage,count:j};//把这个icon属于第几页第几个
			}
			//放置icon的初始位置
			var row=0,col=0;//目前的icon位于第几行第几列
			row = Math.floor(j/this.hNum);//位于第几行
			col = j%this.hNum;//位于第几列
			var cX = col*this.iconWidth + this.lMargin;
			var cY = row*this.iconWidth + this.hMargin;
			baina.setTransform(tDiv,cX,cY);
			//添加到页面中
			if(tempPage >= this.iPages.length){
				tempPage = this.iPages.length - 1;
			}
			this.iPages[tempPage].appendChild(tDiv);
			//把icon都保存到数组中
			//当icon的位置冲突时，插入在其之后，之后会有调整
			if(this.icons[tempPage][j]){
				this.icons[tempPage].splice(++j,0,tDiv);
			}else{
				this.icons[tempPage][j] = tDiv;
			}

			//需获取更新数目的id及更新时间
			postAry.push({"chid":this.Categories[i].id,"lm":updateTime});
			++j;//下一个icon
		}
		this.cPageTotal.innerHTML = "/" + baina.strIconPage(this.iPageLen);
		this.channelWrap.innerHTML = "";
		this.channelWrap.appendChild(tFrag);
		this.hideLoading();

		//为每个频道添加更新数目
		if(this.isGetUpdates){
			this.getUpdates(postAry,updates);
		}

		tChannel.Categories = this.Categories;
		this.channelLocal(tChannel);
		if(this.hArray.length>1){
			//这里做判断是防止重复两次调用adjustPos，因为load事件也调用了adjustPos
			setTimeout(function(){tempThis.adjustPos();},800);//延时强制调整一下，android垃圾...
		}
	},
	getUpdates : function(ary,lastUpdates) {
		//获取用户当前订阅频道的未读文章数量
		if(lastUpdates){
			lastUpdates = JSON.parse(lastUpdates);
		}
		var url = baina.url + "docs/unreadcount";
		var now = new Date();
		baina.ajaxPost(encodeURI(url),ary,function(text){
			if(text){
				var data = JSON.parse(text);
				var tempUpdates = {};//用于存储各个频道的chid和更新数目
				for (var i = 0; i < data.length; i++) {
					var updateNum = 0;
					var icon = document.querySelector("[cid='" + data[i].chid +"']");
					var tspan = document.createElement("span");
					tspan.className = "updates";
					if(data[i].count > 0){
						//优先显示最新的更新数
						updateNum = data[i].count;
					}else if(lastUpdates){
						//更新数为0，则从缓存中获得上一次频道的更新次数
						updateNum = lastUpdates.chUpdates[data[i].chid];
					}
					if(updateNum>0){
						var innerHtml = updateNum > 99 ? "99+" : updateNum;
						tspan.innerHTML = innerHtml;
						icon.appendChild(tspan);
						(function(tspan){
							setTimeout(function(){
								tspan.style["height"] = "20px";
							},2000);	
						})(tspan);
					}
					//保存将当前的更新数
					tempUpdates[data[i].chid] = updateNum;
				}
				//把更新数据存储到缓存中
				var storage = {};
				storage = {"lastUpdateTime":now.getTime(), "chUpdates":tempUpdates};
				baina.setLocal("updates",JSON.stringify(storage));
			}
		},function(text){console.log(text)});
	},
	adjustIconPos : function(){
		//调整icon们的位置，主要在横竖屏转换的时候使用
		this.iconPosition2();//计算icon的位置相关参数
		if(this.iPages && this.iPages.length){
			//清除空余的位置
			for(var i=0;i<this.iPageLen;i++){
				var j=0, icons=this.icons[i];
				while(j<icons.length){
					if(!icons[j]){
						icons.splice(j,1);
					}else{
						++j;
					}
				}
			}
			for(var i=0;i<this.iPageLen;i++){
				//首先调整page的尺寸
				this.iPages[i].style["width"] = this.iconPageWidth + "px";
				baina.setTransform(this.iPages[i],(this.iconPageWidth*(i-this.iconCurPage)),0);
				if(!this.icons[i]){
					//在没有icon的时候，有可能会无意中resize调用
					continue;
				}
				var k=this.icons[i].length;
				if(k>this.eachPageNum){
					//发现当前icon的数量超过了页面可以装载的上限（例如由全屏模式切换回来等等）
					var p1 = this.icons[i].slice(this.eachPageNum);//本页多出来的部分
					if(this.icons[i+1]){
						//下一页存在
						this.icons[i+1] = p1.concat(this.icons[i+1]);//多出来的部分，插入到下一页的前面
						for(var m=p1.length-1;m>=0;m--){
							this.iPages[i+1].insertBefore(p1[m],this.iPages[i+1].firstChild);//把多出来的icon一个个按顺序绑定到下一页中
						}
					}else{
						//下一页不存在
						this.icons[this.iPageLen] = p1;//新增加一页
						var newPage = document.createElement("div");
						newPage.className = "iconPage";
						newPage.setAttribute("page",this.iPageLen);
						this.iPages[this.iPageLen] = newPage;
						for(var m=0,n=p1.length;m<n;m++){
							this.iPages[this.iPageLen].appendChild(p1[m]);//把多出来的icon一个个绑定到新页面中
						}
						this.channelWrap.appendChild(this.iPages[this.iPageLen]);
						this.iPageLen = this.iPages.length;//修改一下整体的长度
					}
					this.icons[i].splice(this.eachPageNum,k);//删掉本页多余的icon
				}else if(k<this.eachPageNum && i<this.iPageLen-1){
					//发现当前页面的icon数量比可容纳的少，且不是最后一页，自动补齐
					for(var m=0;m<this.eachPageNum-k;m++){
						//一共需要从后面补齐this.eachPageNum-k个icon过来
						var leftIcons = [];//剩余的icons合并到一个数组中，全部重新排列
						for(var p=i+1;p<this.iPageLen;p++){
							leftIcons = leftIcons.concat(this.icons[p]);
						}
						if(leftIcons.length){
							//如果还有剩余的icon
							this.icons[i].push(leftIcons[0]);//第一个补到当前页面的最后一个
							this.iPages[i].appendChild(leftIcons[0]);
							leftIcons.shift();//删掉后面数组中被用于补齐的这个icon
							for(var p=i+1;p<this.iPageLen;p++){
								this.icons[p] = leftIcons.slice(this.eachPageNum*(p-(i+1)),this.eachPageNum*(p-i));
								if(this.icons[p].length){
									//页面还有icon剩余
									this.iPages[p].innerHTML = "";
									for(var x=0,y=this.icons[p].length;x<y;x++){
										this.iPages[p].appendChild(this.icons[p][x]);//把icon重新绑定一下
									}
								}else{
									//页面没有icon剩余了
									for(var x=p;x<this.iPageLen;x++){
										this.icons.splice(p,1);
										baina.delNode(this.iPages[p]);//把这页面删掉
										this.iPages.splice(p,1);
									}
									this.iPageLen = this.iPages.length;
									if(this.iconCurPage>=this.iPageLen){
										//如果当前页面不幸被删掉了
										this.iconCurPage = this.iPageLen-1;
										this.iconPageAnimate();//移动一下位置
									}
									break;
								}
							}
						}else{
							//没有剩余的icon可以插入了，退出，不再补充
							break;
						}
					}
				}
				
				for(var j=0,k=this.icons[i].length;j<k;j++){
					if(!this.icons[i][j]){
						continue; //跳过屏幕中icon的空白区域
					}
					var row=0,col=0;//目前的icon位于第几行第几列
					row = Math.floor(j/this.hNum);//位于第几行
					col = j%this.hNum;//位于第几列
					var cX = col*this.iconWidth + this.lMargin;
					var cY = row*this.iconWidth + this.hMargin;
					this.icons[i][j].setAttribute("cx",cX);//把位置记录下来
					this.icons[i][j].setAttribute("cy",cY);
					this.icons[i][j].setAttribute("count",j);//标注一下是第几个
					this.icons[i][j].style["padding"] = this.iconPadding + "px";
					baina.setTransform(this.icons[i][j],cX,cY);
				}
			}
			this.updateCat();//更新一下Categories中的位置信息
			this.channelLocal();//频道信息保存到本地
		}
	},
	manageCList : function(text,local){
		//处理频道icon的列表信息
		var tempThis = this;
		if(text){
			var tResponse;
			if(typeof text=="string" && (text.slice(0,10).toLowerCase().match("<html") || text.slice(0,10).toLowerCase().match("<!doctype"))){
				//数据返回错误的时候，常常返回一个html页面...所以只能这样判断
				this.hideLoading();//隐藏loading
				this.showTip("服务器故障，请稍后重试");
				return false;
			}else if(local==undefined){
				tResponse = JSON.parse(text);
				if(tResponse.sta!=undefined && tResponse.sta==0){
					for(var i=0,l=tResponse.defsrc.length;i<l;i++){
						//频道列表
						this.Categories[i] = {id:tResponse.defsrc[i].chid,name:tResponse.defsrc[i].chname,cov:tResponse.defsrc[i].cov,dt:tResponse.defsrc[i].dt,chtype:tResponse.defsrc[i].chtype,movable:tResponse.defsrc[i].movable};
					}
					if(this.Categories.length){
						this.hideLoading();
						this.channelLocal();//频道信息保存到本地
						this.isUpdateChannel = true;//若刚开始进入频道列表，没有缓存，就会去请求channel，这时已经是最新的数据，无需更新
						this.isGetUpdates = true;
						this.createCList();
					}else{
						this.hideLoading();//隐藏loading
						this.showTip("sorry，请求服务器数据出错，请稍后重试");
					}
				}else{
					this.hideLoading();//隐藏loading
					this.showTip("请求数据出错，请稍后重试");
					return false;
				}
			}
		}else{
			this.createCList();//直接显示本地频道的相关东西
		}
	},
	refreshChannel : function(e){
		//点击频道列表刷新按钮，获取新数据
		this.listOK = false;
		this.curPage = 0;//换频道了，清空原来频道的相关数据
		if(this.displayCat.dt==4){
			//卡片模板
			var target = this.picRows;
			var targetDrag = this.picDrag;
			if(this.picOff){
				target = this.textRows;
				targetDrag = this.noPicDrag;
			}
			target.innerHTML = "";
			baina.setTransition(targetDrag.tTarget,"");
			targetDrag.setcy(0);
		}else{
			this.listWrap.innerHTML = "";
			this.pageNum.innerHTML = "";
			this.pageNum.className = "";
		}
		this.requestRight = false;
		this.requestLeft = false;
		this.initChannel();//重新init一下
	},
	icon_cX : 0,//移动的总位置
	icon_lastcX : 0,//上一个move事件的时候移动的总位置
	icon_lastX : 0,//上一个触点的位置
	icon_startX : 0,//开始的位置
	icon_startY : 0,
	icon_startTime : 0,//开始的时间
	icon_distanceX : 0,//水平方向移动的距离，用来判断是加载上一页还是下一页
	icon_distanceY : 0,
	icon_dragDirec : "",
	curIconPage : null,//当前的icon页
	preIconPage : null,
	nextIconPage : null,
	thirdIconPage : null,
	icon_time : 0,//计时器
	icon_iv : null,//计时器的句柄icon_interval
	icon_touchIcon : false,//touch的时候是否在icon上
	iconMode : false,//编辑icon的模式
	curIcon : null,//当前移动的icon
	i_cX : 0,//当前icon移动的总位置
	i_cY : 0,
	i_lastcX : 0,
	i_lastcY : 0,
	i_lastX : 0,
	i_lastY : 0,
	moveCurIcon : false,//拖动单个icon的状态
	moveChangeNum : 0,//拖动单个icon翻页的次数。这个变量主要是icon一直移动的时候，移动了一屏幕，避免紧接着又移动一屏幕
	delIcon : false,//touchstart的时候，点击在了删除按钮上面
	_iconTouchStart : function(e){
		if(e.touches && e.touches.length>1){
			//这里只允许单指操作
			return false;
		}
		var tempThis = this;
		if(baina.viewData().scrollTop!=1){
			//触碰了list区域，如果浏览器的地址栏没有收起来，则让它收起来
			window.scrollTo(0,1);
		}
		//首先把当前移动的三个页面选出来
		for(var i=0;i<this.iPageLen;i++){
			//所有transition置空
			baina.setTransition(this.iPages[i],"");
		}
		this.curIconPage = this.iPages[this.iconCurPage];
		this.curIconPage.style["display"] = "block";

		if(this.iPageLen-1>this.iconCurPage){
			this.nextIconPage = this.iPages[this.iconCurPage+1];
			this.nextIconPage.style["display"] = "block";

			if(this.iPageLen-1>this.iconCurPage+1){
				this.thirdIconPage = this.iPages[this.iconCurPage+2];
				this.thirdIconPage.style["display"] = "block";
			}else{
				this.thirdIconPage = null;
			}
		}else{
			this.nextIconPage = null;
		}
		if(this.iconCurPage>0){
			this.preIconPage = this.iPages[this.iconCurPage-1];
			this.preIconPage.style["display"] = "block";
		}else{
			this.preIconPage = null;
		}
		this.icon_lastX = this.icon_startX = baina.touchX(e);
		this.icon_startY = baina.touchY(e);
		this.icon_lastcX = this.icon_cX;
		this.icon_distanceX = this.icon_distanceY = 0;
		this.icon_dragDirec = "";
		this.delIcon = false;
		var target = e.target;
		if(target.tagName.toLowerCase()=="img"){
			target = target.parentNode;
		}
		this.icon_startTime = Date.now();
		if(target.tagName.toLowerCase()=="div" && target.getAttribute("cx")){
			//先清除，避免连续的touchstart导致控制外的计时器工作
			clearInterval(this.icon_iv);
			//如果点在icon上面，开始计时。
			this.icon_touchIcon = true;
			this.curIcon = target;//当前icon
			this.icon_iv = setInterval(function(){tempThis.countTime();},5);
		}else if(target.tagName.toLowerCase()=="span" && target.className=="delbtn"){
			//点击了删除按钮
			clearInterval(this.icon_iv);
			this.icon_time = 0;
			this.delIcon = true;
			this.icon_touchIcon = true;
			this.curIcon = target.parentNode;//当前icon
		}else{
			clearInterval(this.icon_iv);
			this.icon_time = 0;
			this.icon_touchIcon = false;
		}
	},
	_iconTouchMove : function(e){
		if(e.touches && e.touches.length>1){
			//这里只允许单指操作
			return false;
		}
		var currentX = baina.touchX(e);
		var currentY = baina.touchY(e);
		if(!this.moveCurIcon){
			//没有在移动单个icon的状态
			if(!this.icon_dragDirec){
				//如果拖拽的方向没有被设定，则需要判断一下是往哪个方向拖拽
				if(Math.abs(currentX - this.icon_startX)>20){
					this.icon_dragDirec = "x";
				}else if(Math.abs(currentY - this.icon_startY)>20){
					this.icon_dragDirec = "y";
				}
			}else{
				clearInterval(this.icon_iv);//开始移动了，清空计时器
				this.icon_time = 0;
			}
			if(this.icon_dragDirec == "x"){
				this.icon_cX = this.icon_lastcX + currentX - this.icon_lastX;
				if((this.icon_cX >=0 && this.iconCurPage==0) || (this.iconCurPage==this.iPageLen-1 && this.icon_cX <= 0)){
					//第一组往右移动的时候、最后一组往左移动的时候，速度减半
					this.icon_cX = this.icon_lastcX + (currentX- this.icon_lastX)/2;
					//限制最大的滑动距离
					if (this.icon_cX > 50){
						this.icon_cX = 50;
					}
					if (this.icon_cX < -50){
						this.icon_cX = -50;	
					}
				}
				this.icon_lastcX = this.icon_cX;
				this.icon_lastX = currentX;
				this.icon_distanceX = currentX - this.icon_startX;
				//var tempOpacity = Math.abs(this.icon_cX)/this.iconPageWidth*0.5;
				//this.curIconPage.style["opacity"] = 1-tempOpacity;
				baina.setTransform(this.curIconPage,this.icon_cX,0);
				if(this.nextIconPage){
					//判读是否nextArtDiv需要跟随移动
					baina.setTransform(this.nextIconPage,(this.icon_cX+this.iconPageWidth),0);
					//this.nextIconPage.style["opacity"] = tempOpacity+0.5;
					if(this.thirdIconPage){
						//判断是否thirdArtDiv需要跟随移动
						baina.setTransform(this.thirdIconPage,(this.icon_cX+this.iconPageWidth*2),0);
					}
				}
				if(this.preIconPage){
					//判读是否prevArtDiv需要跟随移动
					baina.setTransform(this.preIconPage,(this.icon_cX-this.iconPageWidth),0);
					//this.preIconPage.style["opacity"] = tempOpacity+0.5;
				}		
			}else if(this.icon_dragDirec == "y"){
				this.icon_distanceY = currentY - this.icon_startY;
			}
		}else{
			//移动单个icon的状态
			this.curIcon.style["transition-property"] = "opacity";//只保留透明度动画
			this.curIcon.style["-webkit-transition-property"] = "opacity";//只保留透明度动画
			this.i_cX = this.i_lastcX + currentX - this.i_lastX;
			this.i_cY = this.i_lastcY + currentY - this.i_lastY;
			this.i_lastcX = this.i_cX;
			this.i_lastX = currentX;
			this.i_lastcY = this.i_cY;
			this.i_lastY = currentY;
			baina.setTransform(this.curIcon,this.i_cX,this.i_cY);

			//以下根据当前icon的来判断移动
			//iconWidth包括了icon右侧15px的间隙，因此vW需要加15补足
			if(this.i_cX>(0-this.moveChangeNum*50) && this.i_cX+this.iconWidth<(this.vW+15+this.moveChangeNum*50)){
				//在本页面内
				var row=0,col=0;
				//第0个方块的中心坐标是this.lMargin+50+this.iconPadding,this.hMargin+50+this.iconPadding
				row = Math.floor((this.i_cY-this.hMargin-50-this.iconPadding+this.iconWidth)/this.iconWidth);
				col = Math.floor((this.i_cX-this.lMargin-50-this.iconPadding+this.iconWidth)/this.iconWidth);
				if(row<0){
					row = 0;//不能超过最小的限制
				}else if(row>this.vNum-1){
					row = this.vNum-1;//不得超出最大限制
				}
				if(col<0){
					col = 0;
				}else if(col>this.hNum-1){
					col = this.hNum-1;
				}
				var num = this.hNum*row + col;//目前icon的位置序号
				if(num>this.icons[this.iconCurPage].length-1){
					num = this.icons[this.iconCurPage].length-1;//不能超过最后一个
				}
				this.reArrangeIcon(num);//重新排列icon
				if(this.moveChangeNum>0 && this.i_cX+this.iconWidth<this.vW+15 && this.i_cX>0){
					this.moveChangeNum = 0;//如果回到过中央部分，则这个值往回减
				}
			}else{
				//换到下一页
				if(this.i_cX<=(0-this.moveChangeNum*50)){
					//移动到左边一页
					if(this.iconCurPage>0){
						this.iconCurPage--;
						this.iPages[this.iconCurPage].appendChild(this.curIcon);//把当前icon绑到新的页面中去
						this.iconPageAnimate("0.8");//这里动画稍微慢一些
						this.iconChangePage(this.iconCurPage+1);
					}
				}else if(this.i_cX+this.iconWidth >= (this.vW+15+this.moveChangeNum*50)){
					//移动到右边一页
					if(this.iconCurPage<this.iPageLen-1){
						//不是最后一页往右边移动
						this.iconCurPage++;
						this.iPages[this.iconCurPage].appendChild(this.curIcon);//把当前icon绑到新的页面中去
						this.iconPageAnimate("0.8");//这里动画稍微慢一些
						this.iconChangePage(this.iconCurPage-1);
					}
				}
				this.moveChangeNum++;//换了一次页面，计数一次。这个变量主要是一直移动的时候，移动了一屏幕，避免紧接着又移动一屏幕
			}
		}
		e.preventDefault();
	},
	_iconTouchEnd : function(e){
		e.preventDefault();
		if(e.touches && e.touches.length>0){
			//这里只允许单指操作。注意touchend的时候，如果是单指，已经没有手指了，就是0。这个跟start、move都不一样
			return false;
		}
		var tempThis = this;
		clearInterval(this.icon_iv);
		this.icon_time = 0;
		if(!this.icon_touchIcon){
			//如果touchstart没有点击在icon上，且没有移动
			if(this.iconMode && Math.abs(this.icon_distanceX)<10 && Math.abs(this.icon_distanceY)<10){
				this.quitIconMode();//退出编辑icon的模式
			}
		}else{
			//touchstart点击在了icon上面
			if(!this.iconMode && Math.abs(this.icon_distanceX)<10 && Math.abs(this.icon_distanceY)<10){
				//不是编辑icon的状态，且没有移动
				var cid = this.curIcon.getAttribute("cid");
				if(cid){
					if(cid!=this.displayCat.id){
						//如果id不一致，表明切换了频道
						this.listOK = false;
						this.curPage = 0;//换频道了，清空原来频道的相关数据
						this.listWrap.innerHTML = "";
						this.pageNum.innerHTML = "";
						this.pageNum.className = "";
						this.requestRight = false;
						this.requestLeft = false;
					}
					baina.addClass(this.curIcon,"iconActive");
					setTimeout(function(){
						location.hash = "ch" + cid;
						//隐藏之前订阅预览页面中的订阅按钮
						tempThis.hideSubBtn();
						baina.removeClass(tempThis.curIcon,"iconActive");
					},250);//需要延时，否则android有bug，会误点击多一次

					setTimeout(function(){
						//延时处理跳转到"#ch"页面后的数据处理：未读数目清空、更新缓存
						var icon = document.querySelector("[cid='" + cid +"']")
						var lastUpdate = icon.querySelector('[class="updates"]');
						if(lastUpdate){
							lastUpdate.innerHTML = "";
						}
						var chupdates = baina.getLocal("updates");
						if(chupdates){
							var updates = JSON.parse(chupdates);
							updates.chUpdates[cid] = 0;
							baina.setLocal("updates",JSON.stringify(updates));
						}
					},750);//动画优先，延时等到动画结束后进行数据处理

					//track
					baina.track("click", "channel", cid, "screen", this.iconCurPage, this.curIcon.getAttribute("count"));
				}else if(this.curIcon.className=="addBtn"){
					//如果是大加号
					setTimeout(function(){location.hash = "subscribe";},250);//去订阅的页面。需要延时，否则android有bug，会误点击多一次
				}
			}else if(this.delIcon && Math.abs(this.icon_distanceX)<10 && Math.abs(this.icon_distanceY)<10){
				//icon编辑状态，点击了删除icon的按钮，且没有移动。删除这个订阅的频道
				var cid = this.curIcon.getAttribute("cid");
				var count = parseInt(this.curIcon.getAttribute("count"));
				this.removeIcon(cid,count,this.curIcon,this.iconCurPage);
				//track
				baina.track("delete", "channel", cid, "screen", this.iconCurPage, this.curIcon.getAttribute("count"));
			}
		}
		if(this.moveCurIcon){
			//如果是当前icon移动的状态
			this.curIconNormal();//当前icon恢复状态，主要是大小尺寸
		}else{
			if(this.icon_dragDirec == "x"){
				var changePage = false;//是否切换了页面
				if(this.icon_distanceX<-20){
					//往左边移动了，即手指往左边滑动了，且有一段距离
					if(this.iconCurPage<this.iPageLen-1){
						this.iconCurPage++;
						changePage = true;
					}
				}else if(this.icon_distanceX>20){
					//往右边移动了，即手指往右边移动了，且有一段距离
					if(this.iconCurPage>0){
						this.iconCurPage--;
						changePage = true;
					}
				}
				this.iconPageAnimate(0.4,"ease-out");//移动
				this.icon_cX = 0;
				if(changePage){
					this.channelLocal();//把页码信息存到本地
				}
			}
			else if(this.icon_dragDirec == "y"){
				if(this.icon_distanceY>260){
					this.showWelPanel();//下拉，显示欢迎页面
				}
			}
		}
	},
	iconPageAnimate : function(duration, timing){
		//icon的页面移动动画
		var d = duration?duration:0.15;
		var t = timing?timing:"ease";

		var tran = d>0 ? "-webkit-transform "+d+"s "+t : "";
		//var tran = d>0 ? "-webkit-transform "+d+"s "+t+", opacity "+d+"s "+t : "";//如果时间设置为0或负数，则直接跳变
		if(this.curIconPage){
			baina.setTransition(this.curIconPage,tran);
		}
		if(this.preIconPage){
			baina.setTransition(this.preIconPage,tran);
		}
		if(this.nextIconPage){
			baina.setTransition(this.nextIconPage,tran);
			if(this.thirdIconPage){
				baina.setTransition(this.thirdIconPage,tran);
			}
		}

		for(var i=0;i<this.iPageLen;i++){
			//调整各个页面的位置
			//this.iPages[i].style["opacity"] = (i==this.iconCurPage) ? 1 : 0.5;
			if(Math.abs(i-this.iconCurPage) < 2){
				this.iPages[i].style["display"] = "block";
				baina.setTransform(this.iPages[i],(this.iconPageWidth*(i-this.iconCurPage)),0);
			}else{
				this.iPages[i].style["display"] = "none";
			}
		}
		this.cPage.innerHTML = baina.strIconPage(this.iconCurPage + 1);
		this.cPageTotal.innerHTML = "/" + baina.strIconPage(this.iPageLen);
	},
	reArrangeIcon : function(num){
		if(num != undefined){
			//重新排列icon
			var count = parseInt(this.curIcon.getAttribute("count"));//当前icon所在本页的位置
			this.curIcon.setAttribute("count",num);
			if(num<count){
				//移动到了前面
				for(var i=count-1;i>=num;i--){
					if(!this.icons[this.iconCurPage][i]){
						continue; //跳过屏幕中icon的空白区域
					}
					this.icons[this.iconCurPage][i].setAttribute("count",i+1);
					this.icons[this.iconCurPage][i+1] = this.icons[this.iconCurPage][i];
				}
				this.icons[this.iconCurPage][num] = this.curIcon;
			}else if(num>count){
				//移动到了后面
				for(var i=count+1,l=this.icons[this.iconCurPage].length;i<=num&&i<l;i++){
					if(!this.icons[this.iconCurPage][i]){
						continue; //跳过屏幕中icon的空白区域
					}
					this.icons[this.iconCurPage][i].setAttribute("count",i-1);
					this.icons[this.iconCurPage][i-1] = this.icons[this.iconCurPage][i];
				}
				this.icons[this.iconCurPage][num] = this.curIcon;
			}
		}
		var icons = this.icons[this.iconCurPage];//把本页的icon组取出来
		for(var i=0,l=icons.length;i<l;i++){
			if(!icons[i]){
				continue; //跳过屏幕中icon的空白区域
			}
			var row=0,col=0;//目前的icon位于第几行第几列
			row = Math.floor(i/this.hNum);//位于第几行
			col = i%this.hNum;//位于第几列
			var cX = col*this.iconWidth + this.lMargin;
			var cY = row*this.iconWidth + this.hMargin;
			icons[i].setAttribute("cx",cX);//把位置记录下来
			icons[i].setAttribute("cy",cY);
			if(icons[i]!=this.curIcon){
				//当前icon不生效，touchend的时候才生效
				icons[i].style["transform"] = "translate3d("+cX+"px,"+cY+"px,0) scale(0.9)";
				icons[i].style["-webkit-transform"] = "translate3d("+cX+"px,"+cY+"px,0) scale(0.9)";
			}
		}
	},
	iconChangePage : function(from){
		//由于icon移动，切换了页面，需要重新整理以下icons数组。参数from表示从哪个页面过来的，原页面的序号
		var lastCount = parseInt(this.curIcon.getAttribute("count"));//之前的count值
		if(this.iconCurPage<from){
			//如果是从后面的页面往前面移动，则把前面页面的最后一个移动到后面页面的第一个
			var tempIcon = this.icons[this.iconCurPage][this.eachPageNum-1];
			this.icons[this.iconCurPage][this.eachPageNum-1] = this.curIcon;
			this.curIcon.setAttribute("count",this.eachPageNum-1);//设置一下位置
			this.icons[from].splice(lastCount,1);//之前的页面删掉当前icon
			this.icons[from].unshift(tempIcon);//插入到from页面的第一个
			this.iPages[from].insertBefore(tempIcon,this.iPages[from].firstChild);
			for(var i=0;i<=lastCount;i++){
				if(!this.icons[from][i]){
					continue; //跳过屏幕中icon的空白区域
				}
				this.icons[from][i].setAttribute("count",i);
				var row=0,col=0;//目前的icon位于第几行第几列
				row = Math.floor(i/this.hNum);//位于第几行
				col = i%this.hNum;//位于第几列
				var cX = col*this.iconWidth + this.lMargin;
				var cY = row*this.iconWidth + this.hMargin;
				this.icons[from][i].setAttribute("cx",cX);//把位置记录下来
				this.icons[from][i].setAttribute("cy",cY);
				this.icons[from][i].style["transform"] = "translate3d("+cX+"px,"+cY+"px,0) scale(0.9)";
				this.icons[from][i].style["-webkit-transform"] = "translate3d("+cX+"px,"+cY+"px,0) scale(0.9)";
			}
		}else if(this.iconCurPage>from){
			//如果是从前面的页面往后面移动，则把后面页面的第一个移动到前面页面的最后一个
			var tempIcon = this.icons[this.iconCurPage][0];
			this.icons[this.iconCurPage][0] = this.curIcon;
			this.curIcon.setAttribute("count",0);//设置一下位置
			this.icons[from].splice(lastCount,1);//之前的页面删掉当前icon
			this.icons[from].push(tempIcon);//放到到from页面的最后一个
			this.iPages[from].appendChild(tempIcon);
			for(var i=lastCount,l=this.icons[from].length;i<l;i++){
				if(!this.icons[from][i]){
					continue; //跳过屏幕中icon的空白区域
				}
				this.icons[from][i].setAttribute("count",i);
				var row=0,col=0;//目前的icon位于第几行第几列
				row = Math.floor(i/this.hNum);//位于第几行
				col = i%this.hNum;//位于第几列
				var cX = col*this.iconWidth + this.lMargin;
				var cY = row*this.iconWidth + this.hMargin;
				this.icons[from][i].setAttribute("cx",cX);//把位置记录下来
				this.icons[from][i].setAttribute("cy",cY);
				this.icons[from][i].style["transform"] = "translate3d("+cX+"px,"+cY+"px,0) scale(0.9)";
				this.icons[from][i].style["-webkit-transform"] = "translate3d("+cX+"px,"+cY+"px,0) scale(0.9)";
			}
		}
		//有可能在单个icon状态一直移动，以下更新一下页面的情况
		this.curIconPage = this.iPages[this.iconCurPage];
		if(this.iPageLen-1>this.iconCurPage){
			this.nextIconPage = this.iPages[this.iconCurPage+1];
			if(this.iPageLen-1>this.iconCurPage+1){
				this.thirdIconPage = this.iPages[this.iconCurPage+2];
			}else{
				this.thirdIconPage = null;
			}
		}else{
			this.nextIconPage = null;
		}
		if(this.iconCurPage>0){
			this.preIconPage = this.iPages[this.iconCurPage-1];
		}else{
			this.preIconPage = null;
		}
		//更新一下新的页面
		this.reArrangeIcon();
	},
	iconEditMode : function(){
		//进入icon编辑模式，并进行单个icon的移动
		for(var i=0;i<this.iPageLen;i++){
			var icons = this.icons[i];
			for(var j=0,l=icons.length;j<l;j++){
				if(!icons[j]){
					continue; //跳过屏幕中icon的空白区域
				}
				var chtype = icons[j].getAttribute("chtype");//这个icon是否允许删除
				if(icons[j]!=this.curIcon){
					//只要不是当前icon
					icons[j].style["opacity"] = 0.75;
					if(chtype == "n"){
						//可以删除，添加删除按钮
						var tSpan = document.createElement("span");
						tSpan.className = "delbtn";
						icons[j].appendChild(tSpan);
					}
					var i_cX = parseInt(icons[j].getAttribute("cx"));
					var i_cY = parseInt(icons[j].getAttribute("cy"));
					//icons[j].style["opacity"] = 0.85;
					icons[j].style["transform"] = "translate3d("+i_cX+"px,"+i_cY+"px,0) scale(0.9)";
					icons[j].style["-webkit-transform"] = "translate3d("+i_cX+"px,"+i_cY+"px,0) scale(0.9)";//当前icon不变，其余icon缩小
				}else{
					//使得当前icon处于移动状态
					this.curIconBig();
				}
			}
		}
	},
	countTime : function(){
		//计时器，计算长按的时间
		var t = Date.now();
		this.icon_time = t - this.icon_startTime;//间隔的时间
		if(this.iconMode && this.icon_time>200){
			clearInterval(this.icon_iv);
			this.icon_time = 0;
			//进入单个icon的移动
			this.curIconBig();		
		}else if(this.icon_time>700){
			clearInterval(this.icon_iv);
			this.icon_time = 0;
			//进入icon编辑模式，并进行单个icon的移动
			this.iconMode = true;
			this.iconEditMode();
		}
	},
	curIconBig : function(){
		//将当前icon放大
		if(!this.curIcon){
			return false;
		}
		this.moveCurIcon = true;//拖动单个icon的状态
		this.curIcon.style["opacity"] = 0.85;
		this.i_cX = parseInt(this.curIcon.getAttribute("cx"));
		this.i_cY = parseInt(this.curIcon.getAttribute("cy"));
		baina.setTransform(this.curIcon,this.i_cX,this.i_cY);

		var tspan = this.curIcon.getElementsByClassName("delbtn");
		if(tspan.length){
			//删掉删除按钮
			baina.delNode(tspan[0]);
		}
		//初始化当前icon的移动数据，相当于当前被拖动icon的touchstart
		this.moveChangeNum = 0;//翻页次数归零
		this.i_lastX = this.icon_startX;
		this.i_lastY = this.icon_startY;
		this.i_lastcX = this.i_cX;
		this.i_lastcY = this.i_cY;

		//记录当前页面和位置，供track使用
		this.curIcon.setAttribute("o-page", this.iconCurPage);
		this.curIcon.setAttribute("o-count", this.curIcon.getAttribute("count"))
	},
	curIconNormal : function(){
		if(!this.curIcon){
			return false;
		}
		this.moveCurIcon = false;//拖动单个icon的状态
		this.curIcon.style["transition-property"] = "transform,opacity";//恢复两个属性的动画
		this.curIcon.style["-webkit-transition-property"] = "-webkit-transform,opacity";//恢复两个属性的动画
		this.curIcon.style["opacity"] = 0.75;//设置成跟其它icon一样
		var chtype = this.curIcon.getAttribute("chtype");//这个icon是否允许删除
		if(chtype == "n"){
			//可以删除，添加删除按钮
			var _tSpan = this.curIcon.getElementsByClassName("delbtn");
			if(!_tSpan.length){
				var tSpan = document.createElement("span");
				tSpan.className = "delbtn";
				this.curIcon.appendChild(tSpan);
			}
		}
		var cx = this.curIcon.getAttribute("cx");
		var cy = this.curIcon.getAttribute("cy");
		this.curIcon.style["transform"] = "translate3d("+cx+"px,"+cy+"px,0) scale(0.9)";
		this.curIcon.style["-webkit-transform"] = "translate3d("+cx+"px,"+cy+"px,0) scale(0.9)";

		//track移动的位置
		var cid = this.curIcon.getAttribute("cid");
		var oldPage = this.curIcon.getAttribute("o-page");
		var count = this.curIcon.getAttribute("count");
		var oldCount = this.curIcon.getAttribute("o-count");
		baina.track("move", "channel", cid, "position", oldPage+"_"+oldCount, this.iconCurPage+"_"+count);

		this.curIcon = null;//清掉当前icon
		this.updateCat();//更新一下Categories中的位置信息
		this.channelLocal();//频道信息保存到本地
	},
	updateCat : function(){
		//以下把移动过的信息对应到this.Categories中，即频道的顺序、位置保存下来。这里的算法可以优化
		for(var i=0,l=this.icons.length;i<l;i++){
			var pNum = i;//所在的页
			var icons = this.icons[i];
			for(var j=0,k=icons.length;j<k;j++){
				var count = j;//所在页面中的排位
				if(!icons[j]){
					continue; //跳过屏幕中icon的空白区域
				}
				var tId = icons[j].getAttribute("cid");//把当前图标代表的频道id找出来
				if(tId){
					for(var m=0,n=this.Categories.length;m<n;m++){
						if(this.Categories[m].id==tId && this.Categories[m].iconPos){
							//更新以下位置的信息
							this.Categories[m].iconPos.pNum = pNum;
							this.Categories[m].iconPos.count = count;
							break;
						}
					}
				}
			}
		}
	},
	quitIconMode : function(){
		//退出icon编辑模式
		this.iconMode = false;
		this.moveCurIcon = false;//避免有些时候出现的bug。退出编辑模式了，一定不再单个icon移动的模式
		for(var i=0;i<this.iPageLen;i++){
			var icons = this.icons[i];
			for(var j=0,l=icons.length;j<l;j++){
				if(!icons[j]){
					continue; //跳过屏幕中icon的空白区域
				}
				icons[j].style["opacity"] = 1;//把透明度恢复
				baina.setTransition(icons[j],"");//动画置空
				var tspan = icons[j].getElementsByClassName("delbtn");
				if(tspan.length){
					//删掉删除按钮
					baina.delNode(tspan[0]);
				}
				var cx = parseInt(icons[j].getAttribute("cx"));
				var cy = parseInt(icons[j].getAttribute("cy"));
				baina.setTransform(icons[j],cx,cy);//去掉scale属性，当前icon恢复尺寸
			}
		}
	},
	removeIcon : function(chid,count,targetIcon,targetIconPage){
		//点击叉叉，删掉了某个icon，也就是删掉了某个频道
		var tempThis = this;
		baina.delNode(targetIcon);
		for(var i=0,l=this.Categories.length;i<l;i++){
			if(this.Categories[i].id==chid){
				var tNList = baina.getLocal("news"+chid);
				if(tNList){
					//如果有新闻的相关数据，删除
					tNList = JSON.parse(tNList);
					this.delLocalDetail(tNList.data);//删除请求过的detail信息
					baina.clearLocal("news"+chid);//本地的数据也删掉
				}
				this.Categories.splice(i,1);//删除该频道
				break;
			}
		}
		this.icons[targetIconPage].splice(count,1);//删掉这一项
		var len=this.icons[targetIconPage].length;
		if(targetIconPage<this.iPageLen-1){
			//不是最后一页，需要做一个下页第一个icon移动到这一页的动画。如果直接this.adjustIconPos，是直接append，没有动画了就
			if(len){
				//如果本页的icon没有删光，做一下动画。这个主要是考虑这个动画必须先于下页icon到这页的动画
				var icons = this.icons[targetIconPage];
				for(var i=count;i<len;i++){
					if(!icons[i]){
						continue; //跳过屏幕中icon的空白区域
					}
					icons[i].setAttribute("count",i);
					var row=0,col=0;//目前的icon位于第几行第几列
					row = Math.floor(i/this.hNum);//位于第几行
					col = i%this.hNum;//位于第几列
					var cX = col*this.iconWidth + this.lMargin;
					var cY = row*this.iconWidth + this.hMargin;
					icons[i].setAttribute("cx",cX);//把位置记录下来
					icons[i].setAttribute("cy",cY);
					baina.setTransform(icons[i],cX,cY);
				}
			}
			var nextIcon = this.icons[targetIconPage+1][0];
			var row=0,col=0;//目前的icon位于第几行第几列
			row = Math.floor(len/this.hNum);//位于第几行，这里len已经少了一项，所以无需减
			col = len%this.hNum;//位于第几列
			var cX = col*this.iconWidth + this.lMargin - this.vW;
			var cY = row*this.iconWidth + this.hMargin;
			baina.setTransform(nextIcon,cX,cY);
		}else if(!len){
			//最后一页的icon被删光了，需要把最后这个页面也删掉
			this.icons.splice(targetIconPage,1);//删掉这一整项
			baina.delNode(this.iPages[targetIconPage]);//把这页面删掉
			this.iPages.splice(targetIconPage,1);
			this.iPageLen = this.iPages.length;
			if(targetIconPage>=this.iPageLen){
				//删掉的是最后一页
				targetIconPage--;
				this.cPage.innerHTML = baina.strIconPage(targetIconPage + 1);
				this.cPageTotal.innerHTML = "/"+baina.strIconPage(this.iPageLen);
			}
			for(var i=targetIconPage;i<this.iPageLen;i++){
				//重新设置后面的页面位置
				this.iPages[i].setAttribute("page",i);
				baina.setTransition(this.iPages[i],"-webkit-transform 0.3s ease");//动画过来
				baina.setTransform(this.iPages[i],(this.vW*(i-targetIconPage)),0);
			}
		}
		this.delChannels.push(chid);
		baina.setLocal("delChannels",JSON.stringify(this.delChannels));
		setTimeout(function(){tempThis.adjustIconPos();},200);//icon自动补齐
	},
	addOneIcon : function(chid,tName,tCov,tDt,tChtype,tMovable){
		//添加一个icon
		var index = this.delChannels.indexOf(chid);
		if(index!=-1){
			this.delChannels.splice(index,1);
		}
		baina.setLocal("delChannels",JSON.stringify(this.delChannels));
		var hasVacancy = false;//是否存在空位，来放置新增的这个icon
		var pNum,count;//新增icon的位置
		for(var i=this.iconCurPage;i<this.iPageLen;i++){
			//从当前页面开始，往后找空位
			var len = this.icons[i].length;
			if(len<this.eachPageNum){
				//找到空位
				hasVacancy = true;
				pNum = i;
				count = len;
				break;
			}
		}
		if(!hasVacancy){
			//如果没有在已经有的页面中找到空位，则新增一个页面，放在第一个
			pNum = this.iPageLen;
			count = 0;
			var newPage = document.createElement("div");
			newPage.className = "iconPage";
			newPage.setAttribute("page",this.iPageLen);
			this.iPages[this.iPageLen] = newPage;
			this.channelWrap.appendChild(this.iPages[this.iPageLen]);
			this.icons[this.iPageLen] = [];
			baina.setTransform(this.iPages[this.iPageLen],this.vW*(this.iPageLen-this.iconCurPage),0);//就放在右边
			this.iPageLen = this.iPages.length;//修改一下整体的长度
		}	
		var tDiv = document.createElement("div");//创建一个新的icon
		tDiv.setAttribute("cid",chid);
		tDiv.setAttribute("chtype",tChtype);//该按钮可以删除
		tDiv.setAttribute("movable",tMovable);
		tDiv.setAttribute("dt",tDt);
		if(tDt==1){
			tDiv.className = "special";
		}else{
			tDiv.className = "normal";
		}
		if(tCov && tCov.src){
			tDiv.innerHTML = "<img class='iconImg' src='" + encodeURI(tCov.src) + "'>";
		}
		tDiv.innerHTML += "<span class='iconTitle'>" + baina.subs(tName,10,true) + "</span>";//截取一下，最多5个汉字
		tDiv.setAttribute("count",count);
		this.icons[pNum][count] = tDiv;
		if(this.iconMode){
			//如果此时正好是icon的编辑状态
			tDiv.style["opacity"] = 0.75;
			//添加的频道，一定是可以被删除的，添加删除按钮
			var tSpan = document.createElement("span");
			tSpan.className = "delbtn";
			tDiv.appendChild(tSpan);
		}
		this.iPages[pNum].appendChild(this.icons[pNum][count]);//把icon绑到指定的页面中去
		this.iconCurPage = pNum;//跳转到添加icon的那一页
		this.iconPageAnimate(0);
		var row=0,col=0;//目前的icon位于第几行第几列
		row = Math.floor(count/this.hNum);//位于第几行
		col = count%this.hNum;//位于第几列
		var cX = col*this.iconWidth + this.lMargin;
		var cY = row*this.iconWidth + this.hMargin;
		tDiv.setAttribute("cx",cX);//把位置记录下来
		tDiv.setAttribute("cy",cY);
		tDiv.style["padding"] = this.iconPadding + "px";
		baina.setTransform(tDiv,cX,cY);
	},
	delChannel :function(target, chid){
		//从订阅列表中删除一个频道
		var count = -1;//序号的默认值，代表没有找到频道的序号
		var orderedChannelsTemp = this.channelWrap.getElementsByTagName('div');
		for (i = 1; i < orderedChannelsTemp.length; i++) {
			if (orderedChannelsTemp[i].getAttribute("cid") == chid) {
				var targetIcon = orderedChannelsTemp[i];
				var chtype = targetIcon.getAttribute("chtype");
				var pageNumber = parseInt(targetIcon.parentElement.getAttribute("page"));
				count = targetIcon.getAttribute("count");
			}
		}
		if (chtype == "n" && count >= 0) {
			//可删除的项才进行此操作
			this.removeIcon(chid, count, targetIcon, pageNumber);
			target.className = "ordering";//取消订阅成功
		}

	},
	addChannel : function(target, chid, catid){
		//添加一个频道
		for(var i=0,l=this.Categories.length;i<l;i++){
			if(this.Categories[i].id==chid){
				//这个频道居然曾经被添加过，太荒谬了，直接返回
				return false;
			}
		}
		var lSub = baina.getLocal("subscribe");//找本地数据
		var tDt,tCov,tChtype,tMovable,tName="";
		if(lSub){
			lSub = JSON.parse(lSub);
			var catinfo = lSub.catinfo;
			for(var i=0,l=catinfo.length;i<l;i++){
				if(catinfo[i].catid==catid){
					if(catinfo[i].subsrc && catinfo[i].subsrc.length){
						var subList = catinfo[i].subsrc;
						for(var j=0,k=subList.length;j<k;j++){
							if(subList[j].chid == chid){
								//在本地数据中找到点击的频道
								tDt = parseInt(subList[j].dt);
								tCov = subList[j].cov;
								tName = subList[j].chname;
								tChtype = subList[j].chtype;
								tMovable = subList[j].movable;
								break;
							}
						}
					}
					break;
				}
			}
		}else{
			return false;
		}
		this.addOneIcon(chid,tName,tCov,tDt,tChtype,tMovable);
		target.className = "ordered";//订阅成功
		this.Categories.push({id:chid,name:tName,cov:tCov,dt:tDt,iconPos:{},chtype:tChtype,movable:tMovable});
		this.updateCat();//更新一下Categories中的位置信息
		this.channelLocal();//频道信息保存到本地
	},
	channelToggle : function(e){
		var tempThis = this;
		var target = e.target;
		if(target.hasAttribute("chid")){
			var chid = parseInt(target.getAttribute("chid"));
			var catid = parseInt(target.getAttribute("cat"));
			var pos = parseInt(target.getAttribute("pos"));
		}else{
			//点击children的情况
			var chid = parseInt(target.parentElement.getAttribute("chid"));
			var catid = parseInt(target.parentElement.getAttribute("cat"));
			var pos = parseInt(target.parentElement.getAttribute("pos"));
		}

		if(target.tagName.toLowerCase()=="span" && target.className=="ordering"){
			this.addChannel(target, chid, catid);
			var action = "sub";
			this.preloadList(chid);
		}else if(target.tagName.toLowerCase()=="span" && target.className=="ordered"){
			this.delChannel(target, chid);
			var action = "unsub";
		}else{
			//预览当前Channel
			if(chid!=this.displayCat.id){
				//如果id不一致，表明切换了频道
				this.listOK = false;
				this.curPage = 0;//换频道了，清空原来频道的相关数据
				this.listWrap.innerHTML = "";
				this.pageNum.innerHTML = "";
				this.pageNum.className = "";
				this.requestRight = false;
				this.requestLeft = false;
			}
			setTimeout(function(){
				//区分订阅与未订阅的订阅预览
				location.hash = "ch" + chid;
				if(target.tagName.toLowerCase()=="span"){
					target = target.parentNode;
				}
				if(target.tagName.toLowerCase()=="div" && target.getElementsByClassName("ordering")[0]){
					//如果是未订阅频道的订阅预览，刷新按钮变为订阅按钮
					tempThis.showSubBtn();
					tempThis.preSubBtn.setAttribute("cat",catid);
				}else{
					tempThis.hideSubBtn();
				}
			},50);//稍做延迟，保证tracking完成
			var action = "preview";
		}
		
		//添加tracking信息
		baina.track(action, "channel", chid, "channelList", catid, pos);
	},
	initAlbum : function(){
		//初始化图集的详情detail
		//分两种情况，一种是从list页面过来，这时候直接从localStorage里面拿。另一种情况是直接从链接里面搞参数，ajax请求数据展示
		this.showAlbumPanel();
		var tHash = baina.lhash();	
		var hasCatData = this.hasLocalCat();//是否有频道的数据	
		var hasLDate = false;//有数据，但不够全。这时候应该请求tp=0
		this.curPicIndex = 0;//初始化某个图集，图片位置归零
		this.curAlbumId = 0;
		this.curIndex = -1;
		if(tHash.match(/^album\d+$/i)){
			//这里必须判断，要不有时候慢，hash还没切换过来
			this.curAlbumId = tHash.slice(5);
		}
		//如果变量还没有，试图从本地缓存中拿。主要用于用户直接输入url，进入detail的情况
		if(hasCatData && this.displayCat!=undefined && this.displayCat.id!=undefined){
			//必须有当前id，只在当前id所在频道的本地数据中查找
			var lData = baina.getLocal("news"+this.displayCat.id);
			if(lData){
				lData = JSON.parse(lData).data;
				//从缓存里面找，看有没有这篇新闻
				for(var i=0,l=lData.length;i<l;i++){
					if(lData[i].id==this.curAlbumId){
						//除了匹配，还必须有图片，图片的数量要匹配
						this.curIndex = i;
						if(!baina.getLocal("d"+lData[i].id)){
							hasLDate = true;//有数据，但是数据不够全
						}
						break;
					}
				}
				if(this.curIndex>=0 && !hasLDate){
					this.curAlbum();//这里执行了就直接return了，所以后面的东西不需要区分同步、异步。
					return false;
					//这里有一种情况，就是手动输入的detail id，然后返回list。list中并没有这篇文章（因为太老）。这时候又history返回这篇正文，则需要再次请求（按道理也应该缓存起来）。这里有待修改。
				}
			}
		}
		if(tHash && tHash.match(/^album\d+$/i)){
			//不在缓存中，则请求
			var tempThis = this;
			if(navigator.onLine){
				var tempId = tHash.slice(5);
				var url = baina.url + "docs/" + tempId + "?t=" + baina.refreshT() + baina.netWorkType();
				if(hasLDate && this.curIndex>=0 && this.displayCat.id!=undefined){
					//有本地list数据，但是图集的数据不够全
					url += "&tp=0&chid=" + this.displayCat.id;
				}else{
					//全新的请求
					url += "&tp=1";
				}
				this.showLoading();
				baina.ajaxGet(encodeURI(url),function(text){tempThis.manageAlbum(text);},function(text){tempThis.manageAlbum(text);});
			}else{
				this.hideLoading();//隐藏loading
			}
		}else if(!tHash || !tHash.match(/^album\d+$/i)){
			this.showTip("图集读取地址错误，请重试");
			this.hideLoading();
			return false;
		}
	},
	manageAlbum : function(text){
		if(typeof text=="string" && (text.slice(0,10).toLowerCase().match("<html") || text.slice(0,10).toLowerCase().match("<!doctype"))){
			this.showTip("Sorry，读取图集错误，请稍后重试");
			this.hideLoading();//隐藏loading
			return false;
		}else if(text){
			var tResponse;
			tResponse = eval("("+text+")");
			if(tResponse.sta != undefined && tResponse.sta==0){
				if(tResponse.pic!=undefined){
					this.albumLocal(tResponse);//把取到的内容存到本地
					if(tResponse.id == this.curAlbumId){
						//如果返回的数据正好是当前图集的id，则显示当前图集
						if(this.displayCat.id==undefined && tResponse.chid!=undefined){
							//这个地方的情况：用户加载过该频道，但当前在另外一个频道。这个时候点了一个分享链接，回到该频道，所以应该再检索一次
							this.displayCat.id = tResponse.chid;
							var lData = baina.getLocal("news"+this.displayCat.id);
							if(lData){
								lData = JSON.parse(lData).data;
								//从缓存里面找，看有没有这篇新闻
								this.curIndex = -1;
								for(var i=0,l=lData.length;i<l;i++){
									if(lData[i].id == this.curAlbumId){
										this.curIndex = i;
										break;
									}
								}
							}
						}
						this.curAlbum(tResponse);
					}else{
						//上一图集和下一图集的情况
						var tList = baina.getLocal("news"+this.displayCat.id);
						var prevAlbum=null,nextAlbum=null;
						if(tList){
							tList = JSON.parse(tList).data;
							if(this.curIndex>0){
								prevAlbum = tList[this.curIndex-1];
								if(prevAlbum.id == tResponse.id){
									this.curAlbum();//把前个图集的div创建出来
								}
							}
							if(this.curIndex<this.listLen-1){
								nextAlbum = tList[this.curIndex+1];
								if(nextAlbum.id == tResponse.id){
									this.curAlbum();//把后个图集的div创建出来
								}
							}
						}
					}
				}else{
					this.showTip("对不起，读取新闻源错误，请重试");
					this.hideLoading();
				}
				this.hideLoading();
			}else if(tResponse.sta != undefined && tResponse.sta==-7){
				this.showTip("频道已下线");
				this.hideLoading();
			}else if(tResponse.sta!=undefined){
				this.showTip("对不起，内部错误：" + tResponse.sta);
				this.hideLoading();
			}else{
				this.showTip("读取新闻源错误，请重试");
				this.hideLoading();
			}
		}
	},
	requestAlbum : function(albumid){
		//请求图集的所有图片，获取len属性
		var tempThis = this;
		if(navigator.onLine){
			var url = baina.url + "docs/" + albumid + "?tp=0&chid="+this.displayCat.id+"&t=" + baina.refreshT() + baina.netWorkType();
			baina.ajaxGet(encodeURI(url),function(text){tempThis.manageAlbum(text);},function(text){tempThis.manageAlbum(text);});
		}
	},
	curAlbum : function(album){
		//显示当前图集
		var tempThis = this;
		//先把list数据弄出来，如果当前图集在list中，则按照list的顺序依次显示
		var tList = baina.getLocal("news"+this.displayCat.id);
		this.listLen = 0;//当前频道的图集数量
		this.curListLen = 0;//当前图集的图片数量
		var curAlbum=null,prevAlbum=null,nextAlbum=null;
		var toBeDel = [];//要删除的DOM
		if(tList && this.curIndex>=0){
			tList = JSON.parse(tList).data;
			this.artList = tList;
			this.listLen = tList.length;

			curAlbum = baina.getLocal("d"+tList[this.curIndex].id);//从本地取看有没有数据
			if(curAlbum){
				curAlbum = JSON.parse(curAlbum);
				this.curListLen = curAlbum.pics.length;
			}
			if(this.curIndex>0){
				//如果没有这个detail，表明没有请求过完整的图集detail，baina.getLocal会返回空
				prevAlbum = baina.getLocal("d"+tList[this.curIndex-1].id);
				if(prevAlbum){
					prevAlbum = JSON.parse(prevAlbum);
				}
			}
			if(this.curIndex<this.listLen-1){
				nextAlbum = baina.getLocal("d"+tList[this.curIndex+1].id);
				if(nextAlbum){
					nextAlbum = JSON.parse(nextAlbum);
				}
			}
		}
		if(this.curIndex>=0 && this.curIndex<=this.listLen-1){
			var lArts = this.albumWrap.getElementsByClassName("artAWrap");
			var hasPrev=false,hasCur=false,hasNext=false;
			for(var i=0,l=lArts.length;i<l;i++){
				var tIndex = lArts[i].getAttribute("index");//获取该图片处于list中的哪个图集位置
				var tPIndex = lArts[i].getAttribute("pindex");//获取该图片处于图集中的哪张图片
				if(tIndex==this.curIndex && tPIndex==this.curPicIndex){
					hasCur = true;
					this.curPicDiv = lArts[i];
					baina.setTransform(this.curPicDiv,0,0);//设置为当前的文章
					if (tList[this.curIndex].ttl == undefined || tList[this.curIndex].ttl == null){
						this.detailAHead.innerHTML = "";
					}else{
						this.detailAHead.innerHTML = tList[this.curIndex].ttl;
					}
				}else if((tIndex==this.curIndex && this.curPicIndex>0 && tPIndex==this.curPicIndex-1)||(tIndex==this.curIndex-1 && this.curPicIndex==0 && prevAlbum && tPIndex==prevAlbum.pics.length-1)){
					hasPrev = true;
					this.prevPicDiv = lArts[i];
					baina.setTransform(this.prevPicDiv,-this.vW,0);//设置为上一篇
				}else if((tIndex==this.curIndex && this.curPicIndex<this.curListLen-1 && tPIndex==this.curPicIndex+1)||(tIndex==this.curIndex+1 && this.curPicIndex==this.curListLen-1 && nextAlbum && tPIndex==0)){
					hasNext = true;
					this.nextPicDiv = lArts[i];
					baina.setTransform(this.nextPicDiv,this.vW,0);//设置为下一篇
				}else{
					lArts[i].style["display"] = "none";//隐藏不在范围内的DOM，节省资源
					toBeDel.push(lArts[i]);//把不显示的放到一个数组里面，稍后删除（如果不删除，越来越多，for循环越来越长，之后会白屏，手机处理不过来）
				}
			}
			if(!hasCur){
				if(!curAlbum){
					//延时一下，这样更多的性能可以分给动画
					setTimeout(function(){tempThis.requestAlbum(tList[tempThis.curIndex].id);},40);
					this.curPicDiv = null;
				}else{
					this.curPicDiv = this.albumPicDOM(curAlbum.pics[this.curPicIndex],this.curIndex,this.curPicIndex);
					baina.setTransform(this.curPicDiv,0,0);//设置为当前的文章
					this.albumWrap.appendChild(this.curPicDiv);
					if (tList[this.curIndex].ttl == undefined || tList[this.curIndex].ttl == null){
						this.detailAHead.innerHTML = "";
					} else {
						this.detailAHead.innerHTML = tList[this.curIndex].ttl;
					}
				}
			}
			if(!hasPrev){
				if(this.curIndex>0 || this.curPicIndex>0){
					if(this.curPicIndex>0){
						this.prevPicDiv = this.albumPicDOM(curAlbum.pics[this.curPicIndex-1],this.curIndex,this.curPicIndex-1);
						baina.setTransform(this.prevPicDiv,-this.vW,0);//设置为上一篇
						this.albumWrap.appendChild(this.prevPicDiv);
					}else if(prevAlbum){
						var tPLen = prevAlbum.pics.length;
						this.prevPicDiv = this.albumPicDOM(prevAlbum.pics[tPLen-1],this.curIndex-1,tPLen-1);
						baina.setTransform(this.prevPicDiv,-this.vW,0);//设置为上一篇
						this.albumWrap.appendChild(this.prevPicDiv);
					}else{
						//前一个相册还没有请求过detail，请求
						//延时一下，这样更多的性能可以分给动画
						this.prevPicDiv = null;
						setTimeout(function(){tempThis.requestAlbum(tList[tempThis.curIndex-1].id);},40);
					}
				}else{
					//到第一个图集的第一张图片了，把prevPicDiv清理掉
					this.prevPicDiv = null;
				}
			}
			if(!hasNext){
				if(this.curIndex<this.listLen-1 || this.curPicIndex<this.curListLen-1){
					if(this.curPicIndex<this.curListLen-1){
						this.nextPicDiv = this.albumPicDOM(curAlbum.pics[this.curPicIndex+1],this.curIndex,this.curPicIndex+1);
						baina.setTransform(this.nextPicDiv,this.vW,0);//设置为下一篇
						this.albumWrap.appendChild(this.nextPicDiv);
					}else if(nextAlbum){
						this.nextPicDiv = this.albumPicDOM(nextAlbum.pics[0],this.curIndex+1,0);
						baina.setTransform(this.nextPicDiv,this.vW,0);//设置为下一篇
						this.albumWrap.appendChild(this.nextPicDiv);
					}else{
						//后一个相册还没有请求过detail，请求
						//延时一下，这样更多的性能可以分给动画
						this.nextPicDiv = null;
						setTimeout(function(){tempThis.requestAlbum(tList[tempThis.curIndex+1].id);},40);
					}
				}else{
					//到最后一个图集的最后一张图片了，把nextPicDiv清理掉
					this.nextPicDiv = null;
				}
			}
			this.picBar.style["width"] = parseInt(this.vW*(this.curPicIndex+1)/this.curListLen) + "px";
			for(var i=0,l=toBeDel.length;i<l;i++){
				//删掉不需要的，这样最多就三个div
				baina.delNode(toBeDel[i]);
			}

			//track读图的情况
			if(!this.picReadCount){
				this.picReadCount = 1;
				baina.track("pageView", "detailArt", tList[this.curIndex].id, "channelList", this.displayCat.id);
			}

			setTimeout(function(){
				//更新当前图片对应的图集中的curPage
				var curPage = Math.floor(tempThis.curIndex / tempThis.picNum);
				if(tempThis.curPage != curPage){
					tempThis.curPage = curPage;
					tempThis.showCurPage();
				}
			},1000);//延迟处理，避免影响性能
		}else{
			//这个图集的id不在list列表中，可能是手动输入的，或者是以前的url。这里就需要使用传入的ablum参数
			this.dNoList = true;//表明是直接进入的detail
			if(album.chid!=undefined){
				//把当前频道切换到这篇文章所在的频道
				this.displayCat.id = album.chid;
				this.displayCat.name = album.chname;
				this.displayCat.dt = album.dt;
				//这里本来应该分两种情况，一种是本地缓存中本来就有该频道的list列表，一种是完全没有。这里为了从简，统一认为没有来处理，进行覆盖
				this.newsLocal(album.chid,[{src:album.src,pub:album.pub,pics:album.pic.slice(0,1),pop:album.pop,ttl:album.ttl,id:album.id}],Date.now()-2000,0);//自己创造该频道的该频道list的本地缓存，这个list只有一个新闻，就是该条新闻
				var lArts = this.albumWrap.getElementsByClassName("artAWrap");
				for(var i=0,l=lArts.length;i<l;i++){
					lArts[i].style["display"] = "none";
					toBeDel.push(lArts[i]);
				}
				for(var i=toBeDel.length-1;i>=0;i--){
					baina.delNode(toBeDel[i]);//全部删掉
				}
				this.curIndex = 0;
				this.curAlbum();//把这个只有一篇文章list的这篇文章，显示出来
				this.channelLocal();//把当前频道displayCat存一下
			}else{
				this.showTip("加载新闻出错，请重试");
			}
		}
	},
	toggleAlbumHead : function(){
		var tempThis = this;
		if (this.isAlbumHeadShow) {
			this.isAlbumHeadShow = false;
			this.detailAHead.style["opacity"] = "0";
			this.detailAFoot.style["opacity"] = "0";
		} else {
			this.isAlbumHeadShow = true;
			this.detailAHead.style["opacity"] = "1";
			this.detailAFoot.style["opacity"] = "1";
		}
	},
	albumPicStyle : function(w,h){
		//根据全屏的尺寸来计算图片的缩放
		var originalRatio = w/h;
		var returnW,returnH;
		if(this.vW/this.vH >= originalRatio){
			returnH = this.vH;
			returnW = parseInt(this.vH*originalRatio);
		}else{
			returnW = this.vW;
			returnH = parseInt(this.vW/originalRatio);
		}
		return "style='width:"+returnW+"px;height:"+returnH+"px'";
	},
	albumPicDOM : function(pic,index,curindex){
		//创建单张图片的DOM结构
		var tDiv = document.createElement("div");
		tDiv.className = "artAWrap";
		if(index!=undefined){
			tDiv.setAttribute("index",index);
		}
		if(curindex!=undefined){
			tDiv.setAttribute("pindex",curindex);
		}
		if(pic.h && pic.w){
			tDiv.innerHTML = "<img src='"+pic.src+baina.netWorkType(true)+"' "+this.albumPicStyle(pic.w,pic.h)+" onload='baina.showCommonPic(this)' onerror='baina.errorPic(this,\"000\")'/>";
		}else{
			tDiv.innerHTML = "<img src='"+pic.src+baina.netWorkType(true)+"' onload='baina.adjustAlbumPic(this);' onerror='baina.errorPic(this,\"000\")'/>";
		}
		return tDiv;
	},
	albumLocal : function(album){
		//把图集detail数据存到本地
		var tAlbum = {};
		tAlbum.pics = album.pic;
		tAlbum.url = album.url;
		tAlbum.len = album.len;
		tAlbum.dt = album.dt;
		if(album.src){
			tAlbum.src = album.src;
		}
		if(album.pub){
			tAlbum.pub = album.pub;
		}
		if(album.ttl){
			tAlbum.ttl = album.ttl;
		}
		if(album.pop){
			tAlbum.pop = album.pop;
		}
		baina.setLocal("d"+album.id,JSON.stringify(tAlbum));
		this.setDetailAll(album.id);//写入大的detail列表中
	},
	setDetailAll : function(id){
		//把新写入本地缓存的detail数据更新的大的detailAll对象中
		var dAll = baina.getLocal("detailAll");//本地缓存中的detailAll用于记录所有请求了detail的文章
		if(dAll){
			dAll = JSON.parse(dAll);
		}else{
			dAll = {};
		}
		dAll["d"+id] = 1;//标记一下，这篇detail在本地缓存中了
		baina.setLocal("detailAll",JSON.stringify(dAll));
	},
	showAlbumPanel : function(){
		//显示图集detail
		var tempThis = this;
		this.detailAlbumMode = true;
		this.wrapView.style["background"] = "#2e2e2e";//背景颜色变得跟#picbar一致，避免最底部一个像素的白条（因为scrollTo(0,1)了）
		this.channelMode = false;//因为隐藏channel是延时操作，所以这里要提前设置一下
		this.albumDetail.style["display"] = "block";
		setTimeout(function(){
			baina.setTransition(tempThis.albumDetail,"-webkit-transform 0.5s ease");
			baina.setTransform(tempThis.albumDetail,0,0);
			tempThis.loading.className = "dark";//图集detail的loading，需要用黑色的，否则会有毛边
		},5);
		setTimeout(function(){
			//延时一下，这样动画的过程中还能看到频道list页面的东西
			if(!tempThis.channelMode){
				//必须判断，否则用户操作很快的时候，这里延时触发就导致错误
				tempThis.hideChannel();
			}
		},750);
	},
	hideAlbumPanel : function(){
		//隐藏图集detail
		var tempThis = this;
		this.detailAlbumMode = false;
		this.dNoList = false;//不在是直接进入的detail了
		this.wrapView.style["background"] = "";
		baina.setTransition(this.albumDetail,"-webkit-transform 0.5s ease");
		baina.setTransform(this.albumDetail,0,(this.vH+1));
		this.prevPicDiv = null;
		this.nextPicDiv = null;
		this.curPicDiv = null;
		this.loading.className = "";//loading回到正常
		setTimeout(function(){
			//延时一下，这样动画的过程中还能看到detail页面的东西
			tempThis.albumWrap.innerHTML = "";//把detail的块全部清掉
			tempThis.albumDetail.style["display"] = "none";
			tempThis.adjustListPic();//调整list的图片尺寸，因为在图集detaim模式，很可能横竖切换了，导致尺寸变化。而这个时候list是display:none的，调整不了。所以只好显示之后再调整;
		},750);
	},
	p_startX : 0,//开始的位置
	p_startY : 0,//开始的位置
	p_distanceX : 0,//水平方向移动的距离，用来判断是加载上一篇还是下一篇
	p_distanceY : 0,
	p_dragDirec : "",
	p_changePage : false,//是否切换了页面
	_pTouchStart : function(e){
		if((e.touches && e.touches.length>1) || !this.curPicDiv){
			//这里只允许单指操作
			return false;
		}
		if(baina.viewData().scrollTop!=1){
			//触碰了list区域，如果浏览器的地址栏没有收起来，则让它收起来
			window.scrollTo(0,1);
		}
		this.p_startX = baina.touchX(e);
		this.p_startY = baina.touchY(e);
		this.p_distanceX = 0;
		this.p_distanceY = 0;
		this.p_dragDirec = "";
		baina.setAnimation(this.curPicDiv,"");
		//tracking
		this.prevIndex = this.curIndex;
		this.prevPicIndex = this.curPicIndex;
	},
	_pTouchMove : function(e){
		if((e.touches && e.touches.length>1) || !this.curPicDiv){
			//这里只允许单指操作
			return false;
		}
		var tempThis = this;
		var currentX = baina.touchX(e);
		var currentY = baina.touchY(e);
		if(!this.p_dragDirec){
			//如果拖拽的方向没有被设定，则需要判断一下是往哪个方向拖拽
			if(Math.abs(currentX - this.p_startX)>30){
				this.p_dragDirec = "x";
			}else if(Math.abs(currentY - this.p_startY)>10){
				this.p_dragDirec = "y";
			}
		}
		if(this.p_dragDirec == "x"){
			//在移动的过程中就判断位置，进行切换
			if(!this.p_changePage){
				//如果没有切换页面，才进行判读
				this.p_distanceX = currentX - this.p_startX;
				var changePage = false;//是否切换了页面
				if(this.p_distanceX<-70){
					//往左边移动了，即手指往左边滑动了，且有一段距离
					if(this.curIndex<this.listLen-1 || this.curPicIndex<this.curListLen-1){
						if(this.curPicIndex<this.curListLen-1){
							this.curPicIndex++;
							changePage = true;
							//track当前阅读的状态
							if(this.picReadDir != "right" 
								&& this.picReadCount == this.curPicIndex){
								//仅对向左滑动时，且大于已统计个数时
								this.picReadCount += 1;
							}
						}else{
							var tList = baina.getLocal("news"+this.displayCat.id);
							if(tList){
								tList = JSON.parse(tList).data;
								var nextAlbum = baina.getLocal("d"+tList[this.curIndex+1].id);
								if(nextAlbum){
									//必须是有detail数据的情况下，才允许切换。否则保持在原图集
									this.curPicIndex = 0;
									this.curIndex++;
									changePage = true;
								}else{
									//this.showTip("加载下一图集...",1000);
									baina.setAnimation(this.curPicDiv,"leftAni 0.3s ease");
								}
							}
							//开始下一个新的图集，track当前图集的阅读
							this.trackPicReading();
							this.picReadDir = "left";
						}
					}else{
						baina.setAnimation(this.curPicDiv,"leftAni 0.3s ease");
					}
				}else if(this.p_distanceX>70){
					//往右边移动了，即手指往右边移动了，且有一段距离
					if(this.curIndex>0 || this.curPicIndex>0){
						if(this.curPicIndex>0){
							this.curPicIndex--;
							changePage = true;
							//track当前阅读的状态
							if(this.picReadDir == "right" 
								&& this.picReadCount == this.curListLen - this.curPicIndex - 1){
								//仅对向左滑动时，且大于已统计个数时
								this.picReadCount += 1;
							}
						}else{
							var tList = baina.getLocal("news"+this.displayCat.id);
							if(tList){
								tList = JSON.parse(tList).data;
								var prevAlbum = baina.getLocal("d"+tList[this.curIndex-1].id);
								if(prevAlbum){
									//必须是有数据的情况下，才允许切换。否则保持在原图集
									prevAlbum = JSON.parse(prevAlbum);
									this.curIndex--;
									this.curPicIndex = prevAlbum.len-1;
									changePage = true;
								}else{
									//this.showTip("加载上一图集...",1000);
									baina.setAnimation(this.curPicDiv,"rightAni 0.3s ease");
								}
							}
							//开始上一个新的图集，track当前图集的阅读
							this.trackPicReading();
							this.picReadDir = "right";
						}
					}else{
						baina.setAnimation(this.curPicDiv,"rightAni 0.3s ease");
					}
				}
				if(changePage){
					//如果切换的页面，动画
					this.p_changePage = true;
					this.curAlbum();//显示当前图集的当前图片
					//track
					if(tempThis.artList){
						var slideDir = this.p_distanceX < 0 ? "left" : "right";
						var curId = tempThis.artList[this.curIndex].id;
						var prevId = tempThis.artList[this.prevIndex].id;

						baina.track("slide",
							"detailArt", curId+"_"+tempThis.curPicIndex,
							"detailArt", prevId+"_"+tempThis.prevPicIndex,
							slideDir);
					}
				}
			}
		}else if(this.p_dragDirec == "y"){
			this.p_distanceY = currentY - this.p_startY;
		}
		e.preventDefault();
	},
	_pTouchEnd : function(e){
		if((e.touches && e.touches.length>0) || !this.curPicDiv){
			//这里只允许单指操作。注意touchend的时候，如果是单指，已经没有手指了，就是0。这个跟start、move都不一样
			return false;
		}
		var tempThis = this;
		if(Math.abs(this.p_distanceX)>10){
			e.preventDefault();
		}
		if(this.p_dragDirec == "x"){
			if(!this.p_changePage){
				if(this.p_distanceX<-70){
					//往左边移动了，即手指往左边滑动了，且有一段距离
					if(this.curIndex>=this.listLen-1 && this.curPicIndex>=this.curListLen-1 && this.totalPage<this.maxPages){
						//this.showTip("加载数据中...");
						//这里相当于在detail请求list的数据
						if(!this.requestRight){
							var lList = baina.getLocal("news" + this.displayCat.id);
							lList = JSON.parse(lList).data;
							this.dataPosition = "right";
							var lastId = lList[lList.length-1].sort ? lList[lList.length-1].sort : lList[lList.length-1].id;
							this.requestRight = true;//结果返回前，不能再发起right的请求
							var url = baina.url + "sources/"+this.displayCat.id+"/docs" + "?mi=" + lastId + "&t=" + baina.refreshT() + baina.netWorkType();
							if(this.displayCat.dt==1){
								//图集
								url += "&rs=" + this.picNum*this.pages;		
							}else{
								//新闻
								url += "&rs=" + this.newsNum*this.pages;
							}
							baina.ajaxGet(encodeURI(url),function(text){
								tempThis.manageList(text,undefined,true);
								tempThis.curAlbum();//list的数据返回以后，重新组织一下，以便生成nextDiv
								tempThis.showCurPage();//重新计算出list页面的相关数据，这样返回list的时候不会出错
							},function(text){tempThis.manageList(text);});
						}
					}
				}else if(this.p_distanceX>70){
					//往右边移动了，即手指往右边移动了，且有一段距离
					if(this.curIndex<=0 && this.curPicIndex<=0){
						if(this.dNoList){
							//直接进入的detail，需要请求左边的图集
							//this.showTip("加载新闻中...");
							if(!this.requestLeft){
								var lList = baina.getLocal("news" + this.displayCat.id);
								lList = JSON.parse(lList).data;
								this.dataPosition = "left";
								var firstId = lList[0].sort ? lList[0].sort : lList[0].id;
								this.requestLeft = true;//结果返回前，不能再发起left的请求
								var url = baina.url + "sources/"+this.displayCat.id+"/docs" + "?si=" + firstId + "&t=" + baina.refreshT() + baina.netWorkType();
								if(this.displayCat.dt==1){
									//图集
									url += "&rs=" + (this.picNum*this.pages-1);//少请求一篇
								}else{
									//新闻
									url += "&rs=" + (this.newsNum*this.pages-1);
								}
								baina.ajaxGet(encodeURI(url),function(text){
									tempThis.manageList(text,undefined,true);
									tempThis.curAlbum();//list的数据返回以后，重新组织一下，以便生成prevPicDiv
								},function(text){tempThis.manageList(text);});
							}
						}
					}
				}
			}
			this.p_changePage = false;
		}else if(this.p_dragDirec == "y"){
			//detail略有区别，touchend的时候，才返回
			if(this.p_distanceY>90){
				//track阅读的情况
				this.trackPicReading();
				//顶端往下一段距离，直接返回到list页面
				this.detailBack();
				//track滑动的行为
				if(this.artList){
					var tid = this.artList[this.curIndex].id;
					baina.track("slide", "backToChannel", this.displayCat.id, "detailArt", tid+"_"+this.curPicIndex);
				}
			}
		}
	},
	initSubscribe : function(){
		//初始化订阅的分类列表
		var hasLData = this.hasLocalCat();
		if(!hasLData){
			//如果本地没有Categories的数据，直接返回首页
			this.channelBack();
			return false;
		}
		this.showSubPanel();
		var tempThis = this;
		this.subListOK = true;
		var lSub = baina.getLocal("subscribe");//找本地数据
		var url = baina.url + "sub/categories?t=" + baina.refreshT() + baina.netWorkType();
		if(lSub){
			this.showSubCat();
			lSub = JSON.parse(lSub);
			var lm = lSub.lm;
			url += "&lm=" + lm;//把时间参数放上去，这样如果有返回表明类别有更新。
		}else{
			this.showLoading();
		}
		baina.ajaxGet(encodeURI(url),function(text){tempThis.manageSubList(text);},function(text){tempThis.manageSubList(text);}); 
	},
	manageSubList : function(text){
		//处理订阅分类的返回
		if(typeof text=="string" && (text.slice(0,10).toLowerCase().match("<html") || text.slice(0,10).toLowerCase().match("<!doctype"))){
			this.showTip("Sorry，读取订阅列表错误，请稍后重试");
			this.hideLoading();//隐藏loading
			return false;
		}else if(text){
			var tResponse;
			tResponse = eval("("+text+")");
			if(tResponse.sta != undefined && tResponse.sta==0){
				var catinfo = tResponse.catinfo;
				if(catinfo.length){
					//如果有数据，表明分类有变化，重新存一下数据
					this.subLocal(catinfo,tResponse.topsrc,tResponse.lm);
					this.showSubCat();//显示新的类别
				}
			}else if(tResponse.sta!=undefined){
				this.showTip("对不起，内部错误：" + tResponse.sta);
			}else{
				this.showTip("读取订阅列表错误，请重试");
			}
			this.hideLoading();
		}
	},
	subLocal : function(catinfo,topsrc,lm){
		var tLocal = {catinfo:catinfo,topsrc:topsrc,lm:lm};
		baina.setLocal("subscribe",JSON.stringify(tLocal));
	},
	showSubCat : function(){
		//显示订阅的类别
		var lSub = baina.getLocal("subscribe");//找本地数据
		if(lSub){
			lSub = JSON.parse(lSub);
			var catinfo = lSub.catinfo;
			var tFrag = document.createDocumentFragment();
			for(var i=0,l=catinfo.length;i<l;i++){
				var tDiv = document.createElement("a");
				var catid = catinfo[i].catid;
				tDiv.setAttribute("sid",catid);
				tDiv.href = "#cat" + catid;
				var tString = "";
				if(catinfo[i].icon && catinfo[i].icon.src){
					//如果icon的数据存在
					tString += "<span style='background-image:url("+catinfo[i].icon.src+");'></span>";
				}else{
					tString += "<span></span>";//把位置占着
				}
				tString += catinfo[i].catname;
				tDiv.innerHTML = tString;
				tFrag.appendChild(tDiv);

				//添加track
				(function(catid, i){
					baina.addEvent(tDiv,"click",function(e){
						baina.track("click", "channelList", catid, "subCatList", 1, i);
					});
				})(catid, i);
			}
			this.subListDrag.innerHTML = "";
			this.subListDrag.appendChild(tFrag);
		}
	},
	showSubPanel : function(){
		//显示channel订阅的section
		var tempThis = this;
		this.subListMode = true;
		this.subDListMode = false;
		this.channelListMode = false;
		this.subSection.style["display"] = "block";
		this.subTitle.innerHTML = "订阅频道";//改变一下标题
		this.listDrag.setcy(0);//返回顶部
		this.hideSubDPanel();//隐藏订阅具体频道的list
		setTimeout(function(){
			baina.setTransition(tempThis.subSection,"-webkit-transform 0.5s ease");
			baina.setTransform(tempThis.subSection,0,0);
		},5);
		var len = this.hArray.length;
		if(len<2 || this.hArray[len-2]!="sublist"){
			//从订阅二级页面，back回来，不再执行这个，因为已经是hide的状态
			setTimeout(function(){
				//延时一下，这样动画的过程中还能看到六宫格页面的东西
				tempThis.hideCPanel();
			},750);
		}
		//track
		baina.track("pageView", "sub", 1);
	},
	hideSubPanel : function(){
		//隐藏channel订阅的section
		var tempThis = this;
		this.subListMode = false;
		baina.setTransform(this.subSection,0,(this.vH+2));
		setTimeout(function(){
			//延时一下，这样动画的过程中还能看到channel页面的东西
			if(!tempThis.subListMode){
				baina.setTransition(tempThis.subSection,"");
				tempThis.subSection.style["display"] = "none";//把channel订阅的块隐藏
			}
		},750);
	},
	listSub : function(){
		//各个分类下的频道列表
		var hasLData = this.hasLocalCat();
		if(!hasLData){
			//如果本地没有Categories的数据，直接返回首页
			this.channelBack();
			return false;
		}
		this.showSubDPanel();
		var tempThis = this;
		var tHash = baina.lhash();
		var catid = 0;
		if(tHash.match(/^cat\d+$/i)){
			//这里必须判断，要不有时候慢，hash还没切换过来
			catid = tHash.slice(3);
		}
		if(!catid){
			location.hash = "";//直接返回
		}
		this.catid = catid;
		var url = baina.url + "sub/categories/"+catid+"/sources" + "?t=" + baina.refreshT() + baina.netWorkType();
		var lSub = baina.getLocal("subscribe");//找本地数据
		if(lSub){
			var hasCat = false;
			lSub = JSON.parse(lSub);
			var catinfo = lSub.catinfo;
			for(var i=0,l=catinfo.length;i<l;i++){
				if(catinfo[i].catid==catid){
					this.subTitle.innerHTML = catinfo[i].catname;//改变一下标题
					if(catinfo[i].subsrc && catinfo[i].subsrc.length){
						hasCat = true;
						this.showCatList(catinfo[i].subsrc,catid);//直接显示本地的数据
						url += "&lm=" + catinfo[i].lm;//url追加参数，表示本地有数据，请求是否有变化
					}
					break;
				}
			}
			if(!hasCat){
				this.showLoading();
				this.subDListDrag.innerHTML = "";//可能显示了上一个分类的频道列表
				this.DListDrag.setcy(0);//返回顶部
			}
			baina.ajaxGet(encodeURI(url),function(text){tempThis.manageCatList(text);},function(text){tempThis.manageCatList(text);});
			//track
			baina.track("pageView", "channelList", catid);
		}else{
			//没有本地订阅数据，直接不知道怎么进入到二级页面的
			location.hash = "subscribe";//直接去订阅的分类页面
		}
	},
	manageCatList : function(text){
		//处理二级订阅list的返回
		if(typeof text=="string" && (text.slice(0,10).toLowerCase().match("<html") || text.slice(0,10).toLowerCase().match("<!doctype"))){
			this.showTip("Sorry，订阅列表读取错误，请稍后重试");
			this.hideLoading();//隐藏loading
			return false;
		}else if(text){
			var tResponse;
			tResponse = eval("("+text+")");
			if(tResponse.sta != undefined && tResponse.sta==0){
				var subsrc = tResponse.subsrc;
				if(subsrc.length){
					//如果有数据，表明订阅list有变化，重新存一下数据
					this.subCatLocal(subsrc,tResponse.catid,tResponse.lm);
					this.showCatList(subsrc,tResponse.catid);//显示新的频道list
				}
			}else if(tResponse.sta!=undefined){
				this.showTip("对不起，内部错误：" + tResponse.sta);
			}else{
				this.showTip("订阅列表读取错误，请重试");
			}
			this.hideLoading();
		}
	},
	subCatLocal : function(subsrc,catid,lm){
		//把订阅二级频道的数据存到分类中
		var lSub = baina.getLocal("subscribe");//找本地数据
		if(lSub){
			lSub = JSON.parse(lSub);
			var catinfo = lSub.catinfo;
			for(var i=0,l=catinfo.length;i<l;i++){
				if(catinfo[i].catid==catid){
					//找到对应的分类，数据放进去
					catinfo[i].subsrc = subsrc;
					catinfo[i].lm = lm;
					baina.setLocal("subscribe",JSON.stringify(lSub));
					break;
				}
			}
		}
	},
	showCatList : function(subsrc,catid){
		//显示二级频道的列表
		var hashId = 0;
		var tHash = baina.lhash();
		if(tHash.match(/^cat\d+$/i)){
			//这里必须判断，要不有时候慢，hash还没切换过来
			hashId = tHash.slice(3);
		}
		if(hashId==catid){
			//只有是在当前的list下才显示
			this.subDListDrag.innerHTML = "";
			this.DListDrag.setcy(0);//返回顶部
			var tFrag = document.createDocumentFragment();
			for(var i=0,l=subsrc.length;i<l;i++){
				var tDiv = document.createElement("div");
				var chid = subsrc[i].chid;
				var ordered = false;//这个频道是否订阅过
				var tString = "";
				tDiv.setAttribute("chid", chid);
				tDiv.setAttribute("cat", catid);
				tDiv.setAttribute("pos", i);
				if(subsrc[i].logo && subsrc[i].logo.src){
					//如果icon的数据存在
					tString += "<span class='logo' style='background-image:url("+subsrc[i].logo.src+");'></span>";
				}else{
					tString += "<span class='logo'></span>";//把位置占着
				}
				tString += subsrc[i].chname;
				for(var j=0,k=this.Categories.length;j<k;j++){
					if(this.Categories[j].id==chid){
						ordered = true;
						break;
					}
				}
				if(ordered){
					tString += "<span class='ordered'></span>";
				}else{
					tString += "<span class='ordering'></span>";
				}
				tDiv.innerHTML = tString;
				tFrag.appendChild(tDiv);
			}
			this.subDListDrag.appendChild(tFrag);
		}
	},
	showSubDPanel : function(){
		//显示订阅频道的列表（各个分类详细list）
		var tempThis = this;
		this.subDListMode = true;
		this.subListMode = false;
		this.subSection.style["display"] = "block";
		this.subDList.style["display"] = "block";
		setTimeout(function(){
			baina.setTransition(tempThis.subSection,"-webkit-transform 0.4s ease");
			baina.setTransition(tempThis.subDList,"-webkit-transform 0.4s ease");
			baina.setTransition(tempThis.subList,"-webkit-transform 0.4s ease");
			baina.setTransform(tempThis.subSection,0,0);
			baina.setTransform(tempThis.subDList,0,0);
			baina.setTransform(tempThis.subList,-tempThis.vW,0);
		},5);
		setTimeout(function(){
			tempThis.subBack.style["display"] = "block";
		},750);
	},
	hideSubDPanel : function(){
		var tempThis = this;
		this.subDListMode = false;
		baina.setTransform(this.subDList,this.vW,0);
		baina.setTransform(this.subList,0,0);
		this.subBack.style["display"] = "none";
		setTimeout(function(){
			//延时一下，这样动画的过程中还能看到channel页面的东西
			if(!tempThis.subDListMode){
				baina.setTransition(tempThis.subDList,"");
				tempThis.subDList.style["display"] = "none";//把channel订阅的块隐藏
			}
		},750);
	},
	goToSubList : function(){
		//返回到订阅的分类页面
		var len = this.hArray.length;
		if(len>1){
			if(this.hArray[len-2]=="subscribe"){
				this.hArray.pop();
				this.hArray.pop();
				history.back();
				return false;
			}
		}
		location.hash = "subscribe";
	},
	clistPShow : false,//默认状态下，设置面板隐藏
	toggleClistPanel : function(){
		//切换设置面板的显示、隐藏
		if(this.clistPShow){
			this.hideClistPanel();
		}else{
			this.showClistPanel();
		}
	},
	showClistPanel : function(){
		//新闻detail页面的设置按钮
		this.clistPShow = true;
		this.clistSetPanel.style["display"] = "block";
	},
	hideClistPanel : function(){
		this.clistPShow = false;
		this.clistSetPanel.style["display"] = "none";
	},
	trackNewsReading : function(){
		if(this.curArtDiv && this.artList){
			var artEndTiming = new Date();
			var artId = this.artList[this.curIndex].id;
			var duration = artEndTiming - this.artStartTiming;
			var artLength = this.curArtDiv.firstElementChild.offsetHeight;
			baina.track("read", "duration", duration, "detailArt", artId, artLength);
		}
		//无条件清除start timing
		this.artStartTiming = null;
	},
	trackPicReading : function(){
		if(this.artList){
			var artId = this.artList[this.curIndex].id;
			baina.track("read", "duration", this.picReadCount, "detailArt", artId, this.curListLen);
		}
		this.picReadCount = 0;
	},
	shareToWeibo : function(){
		//分享到微博
		if(this.displayCat.id==undefined){
			this.showTip("文章未加载完成，请稍后");
			return false;
		}
		var tHash = baina.lhash();
		if(!tHash.match(/^(album)\d+|(detail)\d+$/i)){
			//只有在新闻、图集的detail页面，才能分享
			return false;
		}
		var url = "http://weibo.cn/ext/share?wm=4124";
		var title="",picSrc,tid,lca,sourceUrl;
		lca = location.href.slice(0,location.href.lastIndexOf("/")+1);
		if(tHash.match(/^album\d+$/i)){
			//分享图集
			if(this.curPicDiv){
				var tList = baina.getLocal("news"+this.displayCat.id);
				if(tList){
					tList = JSON.parse(tList).data;
					tid = tList[this.curIndex].id;
					title = tList[this.curIndex].ttl;
					var detail = baina.getLocal("d"+tid);
					if(detail){
						detail = JSON.parse(detail);
						if(detail.pics && detail.pics.length){
							picSrc = detail.pics[this.curPicIndex].src;
						}
						sourceUrl = detail.url;
					}
				}
				lca += "#album" + tid;
				var itemId = tid + "_" + this.curPicIndex;
			}else{
				this.showTip("图集分享出错，请稍后重试");
				return false;
			}
		}else if(tHash.match(/^detail\d+$/i)){
			//分享新闻
			if(this.curArtDiv){
				tid = this.curArtDiv.id.slice(6);
				var detail = baina.getLocal("d"+tid);//从本地缓存中拿数据
				if(detail){
					detail = JSON.parse(detail);
					title = baina.$("artT"+tid).innerHTML;//找到文章的标题
					if(detail.pic && detail.pic.length){
						picSrc = detail.pic[0].src;//文章使用第一幅图片
					}
					sourceUrl = detail.url;
				}
				lca += "#detail" + tid;
				var itemId = tid;
			}else{
				this.showTip("文章分享出错，请稍后重试");
				return false;
			}
		}
		url += "&rt=" + encodeURIComponent(title);
		url += "&ru=" + encodeURIComponent(sourceUrl ? sourceUrl : lca);
		if(picSrc){
			url += "&tp=" + encodeURIComponent(picSrc);
		}
		baina.track("click", "share", itemId, "channel", this.displayCat.id);

		if(window.dolphinShare && window.dolphinShare.share){
			//海豚浏览器独有接口
			window.dolphinShare.share(title, sourceUrl ? sourceUrl : lca);
		}else{
			window.open(url,"海豚阅读分享");
		}
	},
	detailClick : function(artId, index){
		baina.track("click", "detailArt", artId, "channel", this.displayCat.id, this.curPage+"_"+index);
	},
	exitApp : function(){
		var exitTiming = new Date();
		var timeInterval = exitTiming - this.launchTiming;
		baina.setLocal("reader-duration", timeInterval);
	},
	showToast : function(context){
		this.toast.innerHTML = context;

		//调整toast的尺寸，首先显示出来才能方便获取高度
		this.toast.style["display"] = "block";
		//30为confirm的高
		this.toast.style["left"] = (this.vW - this.toast.clientWidth)/2 + "px";
		//减去底部菜单栏高度，底部边距，以及自身高度。
		this.toast.style["top"] = this.vH - 61 - this.toast.clientHeight + "px";
		//触发淡入动画
		this.toast.style["opacity"] = 1;

		var tempThis = this;
		setTimeout(function(){
			//淡入动画需要1秒，再停留1秒
			tempThis.toast.style["opacity"] = 0
		}, 2000);
		setTimeout(function(){
			//以免页面冗余，完全透明后还是隐藏。淡出动画需要1秒。
			tempThis.toast.style["display"] = "none";
			tempThis.toast.innerHTML = "";
		}, 3000);
	},
	showConfirm : function(content,okCallback,cancelCallback){
		var tempThis = this;

		this.confirmContent.innerHTML = content;

		//确保安全，再清空一次
		this.okBtn.onclick = null;
		this.cancelBtn.onclick = null;
		this.confirmWrap.onclick = null;

		this.okBtn.onclick = function(){
			tempThis.hideConfirm();
			okCallback(1);
		};
		this.cancelBtn.onclick = function(){
			tempThis.hideConfirm();
			if(typeof cancelCallback == "function"){
				cancelCallback(0);
			}
		};
		this.confirmWrap.onclick = function(){
			tempThis.hideConfirm();
			if(typeof cancelCallback == "function"){
				cancelCallback(-1); //被用户忽略
			}
		};

		this.confirmWrap.style["display"] = "block";
		this.initPos();
	},
	hideConfirm : function(){
		//清空绑定的回调函数
		this.okBtn.onclick = null;
		this.cancelBtn.onclick = null;

		//隐藏窗体并清空内容
		this.confirmWrap.style["display"] = "none";
		this.confirmContent.innerHTML = "";
	},
	sendToDesktop : function(){
		var tempThis = this;
		//发送到桌面，海豚专有函数
		if(window.dolphin && window.dolphin.createShortcut){
			this.showConfirm("把海豚阅读添加到桌面？",
			function(){
				var url = location.href.slice(0,location.href.lastIndexOf("/")+1);
				window.dolphin.createShortcut("海豚阅读",url,url+"images/readerlogo.png",10000);
				baina.track("click", "shortCut", 1, null, null, tempThis.iconCurPage);
			},
			function(status){
				baina.track("click", "shortCut", status, null, null, tempThis.iconCurPage);
			});
		}
	},
	settingPShow : false,//默认状态下，设置面板隐藏
	toggleSettingPanel : function(){
		//切换设置面板的显示、隐藏
		if(this.settingPShow){
			this.hideSettingPanel();
		}else{
			if(this.artList){
				var tid = this.artList[this.curIndex].id;
				baina.track("click", "setting", 1, "detailArt", tid, this.curIndex);
			}
			this.showSettingPanel();
		}
	},
	showSettingPanel : function(){
		//新闻detail页面的设置按钮
		this.settingPShow = true;
		this.settingPanel.style["display"] = "block";
	},
	hideSettingPanel : function(){
		this.settingPShow = false;
		this.settingPanel.style["display"] = "none";
	},
	showSubBtn : function(){
		//在订阅预览页面中，当该频道为未订阅，则显示订阅按钮，隐藏刷新按钮
		this.refreshBtn.style.display = "none";
		this.preSubBtn.style.display = "inline-block";
	},
	hideSubBtn : function(){
		this.refreshBtn.style.display = "inline-block";
		this.preSubBtn.style.display = "none";
	},
	toggleFont : function(){
		//切换大字体模式
		if(this.sValues.bigFont){
			this.bigFontOff();
		}else{
			this.bigFontOn();
		}
		//track
		baina.track("click", "bigFont", this.sValues.bigFont, null, null, this.curIndex);
	},
	bigFontOn : function(){
		//大字体模式开启
		this.sValues.bigFont = true;
		baina.createStyle("bigfont.css","bigFont");
		this.fontBig.className = "on";
		this.fontSmall.className = "";
		this.sValuesLocal();//保存到本地
	},
	bigFontOff : function(){
		//大字体模式关闭
		this.sValues.bigFont = false;
		baina.delNode(baina.$("bigFont"));
		this.fontBig.className = "";
		this.fontSmall.className = "on";
		this.sValuesLocal();//保存到本地
	},
	toggleNight : function(){
		//切换夜间模式
		if(this.sValues.nightMode){
			this.nightModeOff();
		}else{
			this.nightModeOn();
		}
		//track
		baina.track("click", "nightMode", this.sValues.nightMode, null, null, this.curIndex);
	},
	nightModeOn : function(){
		//开启夜间模式
		this.sValues.nightMode = true;
		baina.createStyle("nightmode.css","nightMode");
		this.nightOn.className = "on";
		this.nightOff.className = "";
		this.sValuesLocal();//保存到本地
	},
	nightModeOff : function(){
		//关闭夜间模式
		this.sValues.nightMode = false;
		baina.delNode(baina.$("nightMode"));
		this.nightOn.className = "";
		this.nightOff.className = "on";
		this.sValuesLocal();//保存到本地
	},
	togglePicMode : function(){
		//切换无图与有图模式
		if(this.picOff){
			this.picModeOn();
		}else{
			this.picModeOff();
		}
	},
	picModeOn : function(){
		//有图模式
		this.picOff = false;
		this.picWrap.style["display"] = "block";
		this.noPicWrap.style["display"] = "none"; 
		baina.removeClass(this.switchBtn,"noPic");
		if(this.picRows.innerHTML==""){
			//若没有数据
			this.requestList();
		}
	},
	picModeOff : function(){
		//无图模式
		this.picOff = true;
		this.noPicWrap.style["display"] = "block";
		this.picWrap.style["display"] = "none";
		baina.addClass(this.switchBtn,"noPic");
		if(this.textRows.innerHTML==""){
			this.requestList();
		}
	},
	toggleLike : function(target){
		var target = target;
		var icon = target.getElementsByTagName("span")[0];
		var text = target.getElementsByTagName("span")[1];
		var textNum = parseInt(text.innerHTML);
		if(baina.hasClass(icon,"active")){
			//取消赞或分享
			baina.removeClass(icon,"active");
			baina.removeClass(text,"active");
			text.innerHTML = textNum-1;
		}else{
			//赞一个或分享一个
			baina.addClass(icon,"active");
			icon.style["transform"] = "scale(1.5,1.5)";
			icon.style["-webkit-transform"] = "scale(1.5,1.5)";
			setTimeout(function(){
				icon.style["transform"] = "scale(1,1)";
				icon.style["-webkit-transform"] = "scale(1,1)";
			},300);
			setTimeout(function(){
				text.innerHTML = textNum+1;
				baina.addClass(text,"active");
			},500);
		}
	},
	shareCardsToWeibo : function(target){
		var target = target;
		var text = target.getElementsByTagName("span")[1];
		var textNum = parseInt(text.innerHTML);
		text.innerHTML = textNum+1;

		lca = location.href;
		var url = "http://weibo.cn/ext/share?wm=4124";
		var title = "";
		var sourceUrl = target.getAttribute("sourceUrl");
		title = target.getAttribute("author");
		url += "&rt=" + encodeURIComponent(title);
		url += "&ru=" + encodeURIComponent(sourceUrl ? sourceUrl : lca);

		if(window.dolphinShare && window.dolphinShare.share){
			//海豚浏览器独有接口
			window.dolphinShare.share(title, sourceUrl ? sourceUrl : lca);
		}else{
			window.open(url,"海豚阅读分享");
		}
	},
	sValuesLocal : function(){
		//把用户的设置保存到本地
		baina.setLocal("sValues",JSON.stringify(this.sValues));
	},
	swapStatus : function(){
		var tempThis = this;
		this.hideLoading();//切换了，先hide一下，避免之前页面的loading还在
		var tHash = baina.lhash();
		if(tHash.match(/^detail\d+$/i)){
			//显示文章
			this.hArray.push("detail");//管理历史记录
			this.initArticle();
			this.hideCPanel();
			this.hideAlbumPanel();
			this.hideSubPanel();
		}else if(tHash.match(/^album\d+$/i)){
			//显示图集
			this.hArray.push("album");
			this.initAlbum();
			this.hideCPanel();
			this.hideArtPanel();
			this.hideSubPanel();
		}else if(tHash.match(/^ch\d+$/i)){
			this.hArray.push("channel");
			if(!this.listOK){
				this.initChannel();
				setTimeout(function(){
					//延时处理一下，让动画平滑。这个可以优化，init之后出现zaker那样的loading，好了再隐藏前面的模块
					tempThis.hideArtPanel();
					tempThis.hideCPanel();
					tempThis.hideAlbumPanel();
					tempThis.hideSubPanel();
				},100);
			}else{
				this.showChannel();
				this.hideArtPanel();
				this.hideCPanel();
				this.hideAlbumPanel();
				this.hideSubPanel();
			}
		}else if(tHash.match(/^subscribe$/i)){
			//订阅
			this.hArray.push("subscribe");
			if(!this.subListOK){
				this.initSubscribe();
			}else{
				this.showSubPanel();
			}
			this.hideArtPanel();
			this.hideAlbumPanel();
			this.hideChannel();
		}else if(tHash.match(/^cat\d+$/i)){
			//订阅list（各个分类下的频道）
			this.hArray.push("sublist");
			this.listSub();
			this.hideArtPanel();
			this.hideAlbumPanel();
			this.hideChannel();
		}else{
			//直接显示选择频道的页面
			this.hArray.push("chlist");//管理历史记录
			this.listChannel();
			this.hideChannel();
			this.hideArtPanel();
			this.hideAlbumPanel();
			this.hideSubPanel();
		}
	},
	showTip : function(text,time){
		//显示提示。text:显示的提示文本; time:延时多长时间消失
		var tempThis = this;
		this.tipBar.style["display"] = "block";
		this.tipBar.innerHTML = text;
		time = time || 2500;
		if(time<=2500){
			setTimeout(function(){tempThis.tipBar.style["display"] = "none";},time);
		}
	},
	clearNewsLocal : function(){
		//清除所有news/channel的数据。这里默认每个网站下有不到30个频道，频道的id从0开始，不超过30
		var tCh = baina.getLocal("channels");
		if(tCh){
			tCh = JSON.parse(tCh);
			if(tCh.Categories && tCh.Categories.length){
				for(var i=0,l=tCh.Categories.length;i<l;i++){
					//把能删掉的news数据删掉
					if(tch.Categories[i].dt==4){
						baina.clearLocal("cards-text"+tCh.Categories[i].id);
						baina.clearLocal("cards-pic"+tCh.Categories[i].id);
					}else{
						baina.clearLocal("news"+tCh.Categories[i].id);
					}
				}
			}
		}
		baina.clearLocal("channels");//目前频道id混乱，只能先清除channel了
		var tAll = baina.getLocal("detailAll");
		if(tAll){
			tAll = JSON.parse(tAll);
			for(var i in tAll){
				baina.clearLocal(i);//清除所有的detail数据
			}
			baina.clearLocal("detailAll");
		}
	},
	delLocalDetail : function(nList){
		//当新闻的list发生变化时，那些从list中删掉的新闻，有可能请求了detail，需要把detail也删掉
		var tAll = baina.getLocal("detailAll");
		if(tAll){
			tAll = JSON.parse(tAll);
			for(var i=0,l=nList.length;i<l;i++){
				var tId = nList[i].id;
				if(baina.getLocal("d"+tId)){
					baina.clearLocal("d"+tId);//删掉缓存中的detail数据
					delete(tAll["d"+tId]);//删掉对象中的属性
				}
			}
			baina.setLocal("detailAll",JSON.stringify(tAll));
		}
	},
	clearLocalData : function(){
		var tempThis = this;
		this.hideClistPanel();
		//点击首页清除按钮，清空缓存的news数据
		this.showConfirm("您要清除所有缓存数据吗？",
			function(){
				for(var i=0,l=tempThis.Categories.length;i<l;i++){
					//baina.clearLocal("news"+tempThis.Categories[i].id);//清除新闻的数据
					//把能删掉的news数据删掉
					if(tempThis.Categories[i].dt==4){
						baina.clearLocal("cards-text"+tempThis.Categories[i].id);
						baina.clearLocal("cards-pic"+tempThis.Categories[i].id);
					}else{
						baina.clearLocal("news"+tempThis.Categories[i].id);
					}
				}
				var tAll = baina.getLocal("detailAll");
				if(tAll){
					tAll = JSON.parse(tAll);
					for(var i in tAll){
						baina.clearLocal(i);//清除所有的detail数据
					}
					baina.clearLocal("detailAll");
				}
				tempThis.listOK = false;
				tempThis.curPage = 0;//相当于换频道了，清空原来频道的相关数据
				tempThis.listWrap.innerHTML = "";
				tempThis.pageNum.innerHTML = "";
				tempThis.pageNum.className = "";
				tempThis.subListOK = false;//订阅的数据也清除掉
				tempThis.subListDrag.innerHTML = "";
				baina.clearLocal("subscribe");//清除订阅频道的数据
				tempThis.showToast("已经清理缓存");
				baina.track("click", "clearCache", 1, null, null, tempThis.iconCurPage);
			},
			function(status){
				baina.track("click", "clearCache", status, null, null, tempThis.iconCurPage);
		});
	},
	checkVer : function(){
		//检测一下版本，如果版本不对，则强制清除所有缓存，这个主要用于特别大的升级，平常不需要修改baina.js中的版本
		var lVer = baina.getLocal("webzineVersion");
		if(lVer!=baina.ver){
			baina.clearLocalAll();//清除所有缓存数据
			baina.setLocal("webzineVersion",baina.ver);
		}
	},
	hideTip : function(){
		//隐藏提示
		this.tipBar.style["display"] = "none";
	},
	_controlScroll : function(e){
		//控制滚动的函数，用来模拟scrollEnd
		e.preventDefault();
		var tempThis = this;
		clearTimeout(this.scrollTime);
		this.scrollTime = setTimeout(function(){
			if(baina.viewData().scrollTop>1){
				//如果滑过了，就调整回去
				tempThis.adjustPos();
			}
		},300);
	}
}
var reader = new Reader({
	wrapView : "wrapView",
	newslist : "newslist",
	listHead : "listHead",
	listFooter : "listFooter",
	backLBtn : "backLBtn",
	backCBtn : "backCBtn",
	refreshBtn : "refreshBtn",
	refreshCBtn : "refreshCBtn",
	cards : "cards",
	cardsHead : "cardsHead",
	cardsWrap : "cardsWrap",
	picWrap : "picWrap",
	noPicWrap : "noPicWrap",
	picRows : "picRows",
	textRows : "textRows",
	cardsFooter : "cardsFooter",
	cardsTitle : "cardsTitle",
	switchBtn : "switchBtn",
	picLoading : "picLoading",
	textLoading : "textLoading",
	preSubBtn: "preSubBtn",
	pageNum : "pageNum",
	listWrap : "listWrap",
	detail : "detail",
	detailWrap : "detailWrap",
	detailFoot : "detailFoot",
	settingPanel : "settingPanel",
	bsetting : "bsetting",
	settingBtn :"settingBtn",
	homeBtn :"homeBtn",
	homeABtn :"homeABtn",
	shareBtn : "shareBtn",
	sfont : "sfont",
	fontBig : "fontBig",
	fontSmall : "fontSmall",
	snight : "snight",
	nightOn : "nightOn",
	nightOff : "nightOff",
	cList : "cList",
	clistWrap : "clistWrap",
	clistFooter : "clistFooter",
	cPage : "cPage",
	cPageTotal : "cPageTotal",
	sendToDBtn : "sendToDBtn",
	clearBtn : "clearBtn",
	setBtn :"setBtn",
	clistSetPanel: "clistSetPanel",
	exitBtn : "exitBtn",
	addSmall : "addSmall",
	channelWrap : "channelWrap",
	welPanel : "welPanel",
	backBtn : "backBtn",
	albumDetail : "albumDetail",
	albumWrap : "albumWrap",
	detailAHead : "detailAHead",
	detailAFoot : "detailAFoot",
	backABtn : "backABtn",
	shareABtn : "shareABtn",
	picBar : "picBar",
	subSection : "subSection",
	subHead : "subHead",
	subList : "subList",
	subListDrag : "subListDrag",
	subDList : "subDList",
	subDListDrag : "subDListDrag",
	subBack : "subBack",
	subOK : "subOK",
	subTitle : "subTitle",
	loading : "loading",
	picCardLoading : "picCardLoading",
	textCardLoading : "textCardLoading",
	tipBar : "tipBar",
	confirmWrap : "confirmWrap",
	confirmView : "confirmView",
	confirmContent : "confirmContent",
	okBtn : "okBtn",
	cancelBtn : "cancelBtn",
	toast: "toast"
});
</script>